8000 [MRG + 1] Add refit_time_ attribute to model selection by mfeurer · Pull Request #11310 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG + 1] Add refit_time_ attribute to model selection #11310

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 6 commits into from
Jun 20, 2018

Conversation

mfeurer
Copy link
Contributor
@mfeurer mfeurer commented Jun 18, 2018

Reference Issues/PRs

Resolves #8833.

What does this implement/fix? Explain your changes.

This PR implements a new refit_time_ attribute which will be stored in GridSearchCV and RandomizedSearchCV if refit is set to True. This will allow measuring the complete time it takes to perform + hyperparameter optimization and refitting the best model on the whole dataset and will be particularly helpful if the hyperparameter optimization is carried out in parallel.

In particular to GridSearchCV and RandomizedSearchCV. Implements scikit-learn#8833.
Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why WIP? What's the todo list?

refit_time_ : float
Seconds used for refitting the best model on the whole dataset.

This is present only if ``refit`` is set to ``True``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean "if ``refit`` is not False"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, I just fixed the wording.

@mfeurer
Copy link
Contributor Author
mfeurer commented Jun 18, 2018

I wasn't sure if the tests/CI will pass, therefore I decided that this PR isn't ready yet. If that's wrong I'm happy to change the name prior to the tests passing.

@mfeurer
Copy link
Contributor Author
mfeurer commented Jun 18, 2018

There appears to be an issue with time measurement and Windows. Can I disable the check that the refit time is larger than zero for Windows?

:class:`model_selection.RandomizedSearchCV` if ``refit`` is set to ``True``.
This will allow measuring the complete time it takes to perform
hyperparameter optimization and refitting the best model on the whole
dataset.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add :user: thing and PR # (since there's no issue).

assert_true(hasattr(search, "refit_time_"))
assert_true(isinstance(search.refit_time_, float))
if sys.version_info[0] >= 3:
assert_greater(search.refit_time_, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not >= as for the other parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did this - why didn't I realize this before... Please excuse the extra commits.

@mfeurer
Copy link
Contributor Author
mfeurer commented Jun 19, 2018

Unit tests are passing except for one test on travis-ci which fails because of a server error on mldata.org.

@mfeurer mfeurer changed the title [WIP] Add refit_time_ attribute to model selection Add refit_time_ attribute to model selection Jun 19, 2018
@mfeurer mfeurer changed the title Add refit_time_ attribute to model selection [MRG] Add refit_time_ attribute to model selection Jun 19, 2018
@amueller
Copy link
Member

ugh that's annoying. I restarted that one.

Copy link
Member
@amueller amueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@amueller amueller changed the title [MRG] Add refit_time_ attribute to model selection [MRG + 1] Add refit_time_ attribute to model selection Jun 19, 2018
Copy link
Member
@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jnothman jnothman merged commit 768ff4d into scikit-learn:master Jun 20, 2018
georgipeev pushed a commit to georgipeev/scikit-learn that referenced this pull request Jun 20, 2018
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.

Retrieving time to refit the estimator in BaseSearchCV
3 participants
0