10000 Re-add `BayesSearchCV.best_score_` needed by some examples · scikit-optimize/scikit-optimize@c539988 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit c539988

Browse files
kerncglouppe
authored andcommitted
Re-add BayesSearchCV.best_score_ needed by some examples
Removed in 9461bfe "Remove BayesSearchCV(iid=) parameter deprecated in sklearn 0.24 (#988)"
1 parent 9461bfe commit c539988

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

skopt/searchcv.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@ def _check_search_space(self, search_space):
360360
"Search space should be provided as a dict or list of dict,"
361361
"got %s" % search_space)
362362

363+
# copied for compatibility with 0.19 sklearn from 0.18 BaseSearchCV
364+
@property
365+
def best_score_(self):
366+
check_is_fitted(self, 'cv_results_')
367+
return self.cv_results_['mean_test_score'][self.best_index_]
368+
363369
@property
364370
def optimizer_results_(self):
365371
check_is_fitted(self, '_optim_results')

0 commit comments

Comments
 (0)
0