-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Description
Unlike the regular scikit-learn Pipeline object there is no option to turn off an estimator in the parameter grid (with None). This is extremely useful for model selection using (Gridsearch) crossvalidation.
Either the imblearn Pipeline object is to be changed, or the imblearn transformers as to be compatible with sklearn's Pipeline.
Steps/Code to Reproduce
from imblearn.pipeline import Pipeline
from sklearn.models import svm
from imblearn.over_sampling import SMOTE
estimators = [('resample', SMOTE()), ('classify', svm.SVC())]
pipe = Pipeline(estimators)
param_grid = {'resample': [None, SMOTE()],}
gridsearch = GridSearch(pipe, param_grid)
gridsearch.fit(X, y)
Expected Results
Regular old gridsearch starts with None estimator enabled
Actual Results
Error saying None is not an estimator object.
Versions
Linux-4.4.0-59-generic-x86_64-with-Ubuntu-16.04-xenial
('Python', '2.7.12 (default, Jul 1 2016, 15:12:24) \n[GCC 5.4.0 20160609]')
('NumPy', '1.12.0')
('SciPy', '0.18.1')
('Scikit-Learn', '0.18.1')
('Imbalanced-Learn', '0.2.1')
Metadata
Metadata
Assignees
Labels
No labels