1. Home
  2. Data Science
  3. Scikit-learn
  4. What does cross_val_score report when given a model, X, y…

Added 30 Nov -0001

What does cross_val_score report when given a model, X, y and cv=5?

  1. A single score computed on the full dataset
  2. Five fitted model objects returned for reuse
  3. The best hyperparameter values found during the parameter search
  4. Five scores, one per fold, from rotating validation splits Correct answer

Correct answer

D. Five scores, one per fold, from rotating validation splits

17 views

MCQSEXAM

Explanation

cross_val_score splits the data into five folds, trains on four and scores the fifth, repeating so every fold serves once as validation, then returns the array of five scores. Averaging them gives a more stable estimate than one train-test split, and the spread shows how sensitive the model is to the partition. The related cross_validate returns multiple metrics and timings, and it does not tune hyperparameters; GridSearchCV does that.

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