Skip to content

BUG: check_cv check for cv is 'warn' instead of cv == 'warn' which is raising an exception with n_jobs=-1 #12154

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
glemaitre opened this issue Sep 25, 2018 · 1 comment · Fixed by #12155
Labels
Milestone

Comments

@glemaitre
Copy link
Member

glemaitre commented Sep 25, 2018

In _split.py, cv is 'warn' will not work as intended since cv will be copied if n_jobs=-1.

from sklearn.datasets import load_iris                                               
from sklearn.model_selection import GridSearchCV                                     
from sklearn.model_selection import cross_validate                                   
from sklearn.svm import SVC                                                          
                                                                                     
X, y = load_iris(return_X_y=True)                                                    
clf = SVC(gamma='auto')                                                              
grid = GridSearchCV(clf, param_grid={'C': [1, 10]}, iid=False)                       
score = cross_validate(grid, X, y,                                                   
                       n_jobs=-1,                                                    
                       cv=5, error_score='raise')  # to remove deprecation warning
ValueError: Expected cv as an integer, cross-validation object (from sklearn.model_selection) or an iterable. Got warn.
@jnothman
Copy link
Member

I have to get the lgtm.com alerts back on.

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

Successfully merging a pull request may close this issue.

2 participants