7

From my understanding:

best_estimator_ provides the estimator with highest score; best_score_ provides the score of the selected estimator; cv_results_ may be exploited to get the scores of all estimators.

However, it is not clear to me how to get the estimators themselves.

halfelf
  • 9,737
  • 13
  • 54
  • 63
  • 2
    `GridSearchCV` already has the best estimator fitted, assuming you kept `refit=True`. You can simply use `my_estimator = clf.best_estimator_`, then predict with `my_estimator.predict(X)`. Alternatively, you could also predict with `clf.predict(X)`. However, if you want the other estimators, then you'll have to iterate through your param grid with the estimator object you used and fit on your training data. – Scratch'N'Purr Oct 12 '18 at 08:15

1 Answers1

3

As I see it, you cannot. But what you can do is taking the best parameter combination from best_params_ and fit the model again with those same parameters. Check out attributes of GridSearchCV

Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128
Novak
  • 2,143
  • 1
  • 12
  • 22