1. Home
  2. Data Science
  3. Scikit-learn
  4. A pipeline-free workflow calls scaler.fit_transform(X_test)…

Added 30 Nov -0001

A pipeline-free workflow calls scaler.fit_transform(X_test) before evaluating a model. What is the consequence?

  1. Test statistics leak into preprocessing, so the reported score is optimistically biased Correct answer
  2. No effect at all, because scaling cannot change model accuracy on any dataset
  3. It causes the model to underfit, lowering the reported score well below the true value
  4. The test set silently becomes the training set, so the model never sees genuinely new data

Correct answer

A. Test statistics leak into preprocessing, so the reported score is optimistically biased

17 views

MCQSEXAM

Explanation

Data leakage occurs when information from the evaluation set influences preprocessing: fitting the scaler on test data lets its mean and variance shape the transformation, so the set is no longer unseen. The rule is to fit on the training fold and only call transform on the test fold. Wrapping the scaler and estimator in a Pipeline makes cross-validation enforce this automatically.

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