Skip to content

Commit

Permalink
Re-add BayesSearchCV.best_score_ needed by some examples
Browse files Browse the repository at this point in the history
Removed in 9461bfe
"Remove BayesSearchCV(iid=) parameter deprecated in sklearn 0.24 (scikit-optimize#988)"
  • Loading branch information
kernc committed May 8, 2021
1 parent 9461bfe commit 9843381
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions skopt/searchcv.py
Expand Up @@ -360,6 +360,12 @@ def _check_search_space(self, search_space):
"Search space should be provided as a dict or list of dict,"
"got %s" % search_space)

# copied for compatibility with 0.19 sklearn from 0.18 BaseSearchCV
@property
def best_score_(self):
check_is_fitted(self, 'cv_results_')
return self.cv_results_['mean_test_score'][self.best_index_]

@property
def optimizer_results_(self):
check_is_fitted(self, '_optim_results')
Expand Down

0 comments on commit 9843381

Please sign in to comment.