1. Home
  2. Data Science
  3. Scikit-learn
  4. What is the main benefit of wrapping preprocessing and a…

Added 30 Nov -0001

What is the main benefit of wrapping preprocessing and a model in a scikit-learn Pipeline?

  1. It trains all steps in parallel to save wall-clock time
  2. It automatically selects the best model among candidates
  3. It caches the test set so it is scored only once
  4. Cross-validation refits the steps on each training fold Correct answer

Correct answer

D. Cross-validation refits the steps on each training fold

15 views

MCQSEXAM

Explanation

A Pipeline chains transformers and a final estimator so that during cross-validation the transformers are refitted on each training fold only, preventing leakage of validation statistics. It also bundles the whole workflow into one object that can be passed to GridSearchCV, saved, and called with a single fit or predict. Step names form a namespace, so parameters are addressed as stepname__param in a search grid.

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