Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG][HOTFIX] BUGFIX _store train_scores only if return_train_score is True #7535

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

Merged
merged 1 commit into from
Sep 30, 2016

Conversation

raghavrv
Copy link
Member

Extremely sorry for the sloppiness. This should be back ported into 0.18.

@amueller @jnothman Apologies :(

@GaelVaroquaux
Copy link
Member

Why is it optional? Ie, what does storing train_score when we should be break?

@raghavrv
Copy link
Member Author

No we have an option return_train_score that can be set to False. In the current master if it is set to False, it raises an error without this bugfix due to my stupidity. Apologies again.

@raghavrv
Copy link
Member Author

raghavrv commented Sep 29, 2016

(One example where it fails)

>>> from sklearn.model_selection import GridSearchCV
>>> from sklearn.svm import LinearSVC
>>> from sklearn.datasets import make_classification
>>> X, y = make_classification()
>>> svm = LinearSVC()
>>> gs = GridSearchCV(svm, param_grid={'C': [0.1, 0.001]},
...                   return_train_score=False)
>>> gs.fit(X, y)
UnboundLocalError: local variable 'train_scores' referenced before assignment

@raghavrv
Copy link
Member Author

On why we even have that option, it was added so users who don't need it can turn it off to keep the cv_results_ concise...

@amueller
Copy link
Member

gah so the false case wasn't tested? That's bad. re back-port: it's release, we need to do 0.18.1 for this fix.

@amueller
Copy link
Member

LGTM

@NelleV
Copy link
Member

NelleV commented Sep 30, 2016

Hi @raghavrv
In the future, it would be helpful to have a clear message in the PR main message. I can understand what's going on from Gael's question and the code, but it is much much easier to review when the author clearly explains the content of the PR.

@NelleV NelleV merged commit 3619bd3 into scikit-learn:master Sep 30, 2016
@jnothman
Copy link
Member

Sorry for the reviewing fail :/

@raghavrv raghavrv deleted the hotfix branch September 30, 2016 09:43
@raghavrv
Copy link
Member Author

@NelleV Thanks for the feedback and merge. Yes I've been skimping on PR descriptions lately. Apologies... I'll try to make a clear description from the next PR.

@amueller
Copy link
Member

So are we gonna do a 0.18.1 relatively soon then?

TomDLT pushed a commit to TomDLT/scikit-learn that referenced this pull request Oct 3, 2016
amueller pushed a commit to amueller/scikit-learn that referenced this pull request Oct 14, 2016
Sundrique pushed a commit to Sundrique/scikit-learn that referenced this pull request Jun 14, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
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 this pull request may close these issues.

5 participants