1. Home
  2. Data Science
  3. Scikit-learn
  4. GridSearchCV(scoring='f1') is used with a classifier and…

Added 30 Nov -0001

GridSearchCV(scoring='f1') is used with a classifier and cv left at its default. Which splitter is applied?

  1. StratifiedKFold with 5 splits, which preserves each class ratio inside every fold Correct answer
  2. KFold with 5 splits and no shuffling, which keeps the original row ordering fully intact
  3. LeaveOneOut, because grid search always maximises the number of fitted models
  4. TimeSeriesSplit, because f1 scoring requires chronologically ordered folds here

Correct answer

A. StratifiedKFold with 5 splits, which preserves each class ratio inside every fold

15 views

MCQSEXAM

Explanation

GridSearchCV inherits check_cv, which returns StratifiedKFold(5) for classifiers and KFold(5) for regressors when cv is an integer. Stratification keeps rare classes represented in every fold, which stabilises f1 and recall estimates. Passing an explicit splitter, or a grouping-aware one such as GroupKFold, prevents leakage when rows are not independent.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? 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