10BC0 No option to turn off pipeline estimators with None in params · Issue #226 · scikit-learn-contrib/imbalanced-learn · GitHub
[go: up one dir, main page]

Skip to content
No option to turn off pipeline estimators with None in params #226
@GillesJ

Description

@GillesJ

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0