Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

best_params_ missing on GridSearchCV #73

Open
dklischies opened this issue Nov 24, 2017 · 3 comments
Open

best_params_ missing on GridSearchCV #73

dklischies opened this issue Nov 24, 2017 · 3 comments
Assignees
Labels

Comments

@dklischies
Copy link

dklischies commented Nov 24, 2017

The best_params_ dict seems to be missing from GridSearchCV, even if refitting is enabled.
grid_search.py#L195 refers to that parameter, it is determined in grid_search.py#L371 but never actually exposed after fitting. This contradicts both, your own docs and the Scikit Learn 0.19.1 and 0.20.0 docs. Was this attribute purposefully not exposed or is this a bug? Depending on your answer, I'd be happy to provide a PR for a change of the docs or the code to resolve this.

See also #37 which uncovered this a year ago.

srowen pushed a commit that referenced this issue Dec 8, 2018
Fix `best_params_` not being set after a call to `fit`. This resolves issue #73
@srowen srowen added the bug label Dec 8, 2018
@srowen srowen self-assigned this Dec 8, 2018
@srowen
Copy link
Collaborator

srowen commented Dec 8, 2018

See #79 as a related issue. I think the issue is that the doc was just copied from scikit, but this subclass can't set the attributes. I think we need to pull them from the docs. Therefore it ends up being a matter of fixing the warnings in #37

@srowen srowen removed the bug label Dec 8, 2018
@srowen srowen closed this as completed Dec 8, 2018
@srowen
Copy link
Collaborator

srowen commented Dec 9, 2018

I'm reopening this as there is clearly an issue here, though the 'quick fixes' don't work:

#37
#79
#84
#85

See in particular #79

It seems like the intent is to set these attributes for parity with scikit, but, they can't be set directly. There may be a simple answer; I don't know it yet. Ideas welcome here!

@austinwiltshire
Copy link

I'm on 19.2 of scikit learn and can't reproduce this issue when trying to add in best_params_ manually, at least not when running run_tests.sh.

Is there another way to reproduce the bug?

I tried by adding this to line 164 in base_search.py, then ran tests.

 self.best_params_ = results["params"][self.best_index_]

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

No branches or pull requests

3 participants