Skip to content

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

Merged
NelleV merged 1 commit into
scikit-learn:masterfrom
raghavrv:hotfix
Sep 30, 2016
Merged

NelleV merged 1 commit into
scikit-learn:masterfrom
raghavrv:hotfix

Conversation

@raghavrv

Copy link
Copy Markdown
Member

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

@amueller @jnothman Apologies :(

@GaelVaroquaux

Copy link
Copy Markdown
Member

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

@raghavrv

Copy link
Copy Markdown
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

raghavrv commented Sep 29, 2016 •

Copy link
Copy Markdown
Member Author

(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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

LGTM

@NelleV

NelleV commented Sep 30, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

Sorry for the reviewing fail :/

@raghavrv
raghavrv deleted the hotfix branch September 30, 2016 09:43
@raghavrv

Copy link
Copy Markdown
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
Copy Markdown
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