As a user I must confess that I like the flat numpy API, both in
interactive sessions and in regular code. The main con is that it's
often hard to find the source code of a particular class or function,
especially when it's a builtin object from a CPython extension.
Fortunately in our case, most of the public API is made of regular
Python classes / functions with a __file__ attribute and in turn wrap
private compiled extensions.
However flattening the scikit-learn API would feel weird sometimes.
For instance I find skl.SGDClassifier (without the
sklearn.linear_model) misleading. The sklearn.linear_model namespace
is informative in that case. A feed forward 2 layers neural net is
technically also a SGD base Classifier. But maybe the SGDClassifier
name is just bad and should be SGDLinearClassifier in general
independently of the flat namespace.
I also feel like Gael that providing two official public APIs, one for
interactive scripting, the other for (clean | pure) application code
to be confusing, especially for newcomers.
Let add another option to Joel proposals:
Option #5 to Joel's proposals: have a __all__ list in sklearn.__init__
that imports the first level public package names (e.g. everything but
utils basically) to make it possible to do:
import sklearn as skl
skl.grid_search.GridSearchCV(skl.pipeline.Pipeline([
('sel', skl.feature_selection.SelectKBest(skl.feature_selection.chi2)),
('clf', skl.svm.LinearSVC())
], {'clf__C': [.1, 1.]}))
Possible cons:
- import time might slow down a bit: to be benched to measure whether
this is negligible or not
- we should be careful in the sklearn.__init__ to import stuff in the
right order to avoid introducing circular dependencies but our test
suite should check that right away for us
--
Olivier
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general