8000 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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
GillesJ opened this issue Feb 2, 2017 · 2 comments · Fixed by #231
Closed

No option to turn off pipeline estimators with None in params #226

GillesJ opened this issue Feb 2, 2017 · 2 comments · Fixed by #231

Comments

@GillesJ
Copy link
GillesJ commented Feb 2, 2017

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')

@glemaitre
Copy link
Member

Thanks, we will keep the issue opened because this is something which we will soon investigate.

We cannot rush into that issue because there is a discussion and PRs which are going to change the behaviour of Pipeline in scikit-learn.

For all details go to: PR 7990 and 8157

@chkoar
Copy link
Member
chkoar commented Feb 3, 2017

@GillesJ I think that we discussed this before. Look here #162 (comment)

Also, if you have time check out this example https://github.com/scikit-learn-contrib/imbalanced-learn/blob/master/examples/applications/plot_over_sampling_benchmark_lfw.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0