1. Home
  2. Data Science
  3. Scikit-learn
  4. A GridSearchCV object is fitted with refit=True. What does…

Added 30 Nov -0001

A GridSearchCV object is fitted with refit=True. What does calling predict afterwards use?

  1. The estimator fitted on the first fold only
  2. An ensemble average of all candidate estimators
  3. It raises NotFittedError because refit must be False before predict
  4. The best estimator refitted on the full training set, not just the winning fold Correct answer

Correct answer

D. The best estimator refitted on the full training set, not just the winning fold

15 views

MCQSEXAM

Explanation

Refitting: with refit=True, after the search finishes the best hyperparameters are used to fit one model on all training data, and that model becomes best_estimator_ and serves predict. With refit=False no final model is retained, because best_estimator_ is absent, so you must fit one yourself before predicting. Reporting the search's own score as a performance estimate is biased, because the same data selected the hyperparameters; nested cross-validation is the clean alternative.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs