From 984338152e930edaab1fa6c630a41e89e4e54d71 Mon Sep 17 00:00:00 2001 From: Kernc Date: Sat, 8 May 2021 04:07:12 +0200 Subject: [PATCH] Re-add `BayesSearchCV.best_score_` needed by some examples Removed in 9461bfecc12c8cab7ae18a55e44e1d258b3c09c9 "Remove BayesSearchCV(iid=) parameter deprecated in sklearn 0.24 (#988)" --- skopt/searchcv.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/skopt/searchcv.py b/skopt/searchcv.py index a37bc79a..fbf406f6 100644 --- a/skopt/searchcv.py +++ b/skopt/searchcv.py @@ -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')