sklearn
¶
General Idea¶
Ibex lazily wraps sklearn
. When a module starting with ibex.sklearn
is import
-ed, Ibex will load the corresponding module from sklearn
, wrap the estimator classes using ibex.frame()
, and load the result. For example say we start with
>>> import sklearn
>>> import ibex
sklearn.linear_model
is part of sklearn
,
therefore ibex.sklearn
will have a counterpart.
>>> 'linear_model' in sklearn.__all__
True
>>> 'linear_model' in ibex.sklearn.__all__
True
>>> from ibex.sklearn import linear_model as pd_linear_model
foo
is not part of sklearn
,
therefore ibex.sklearn
will not have a counterpart.
>>> 'foo' in sklearn.__all__
False
>>> 'foo' in ibex.sklearn.__all__
False
>>> # Next line won't work!
>>> from ibex.sklearn import foo
As noted above, Ibex wraps the estimator classes it finds in the module:
>>> from sklearn import linear_model
>>> linear_model.LinearRegression()
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
>>> pd_linear_model.LinearRegression()
Adapter[LinearRegression](copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
Tip
Ibex does not modify the code of sklearn
in any way. It is absolutely possibly to import
and use both sklearn
and ibex.sklearn
simultaneously.
Differences From sklearn
¶
Since pandas.DataFrame
and pandas.Series
are not identical to numpy.array
s (which is the reason to use the former), some changes are made in ibex.sklearn
relative to the corresponding elements in sklearn
. ibex.sklearn
in
API lists the differences.