61. Why should a data scaler or imputer usually be fitted on training data rather than on the entire dataset?
EasyMachine learning basics
Technical
Show model answer
Fitting preprocessing on the full dataset allows information from the evaluation population to influence the learned transformation. This can make the reported performance more optimistic than a genuine unseen-data evaluation.
Fit learned preprocessing within each training partition and apply that fitted transformation to its validation partition. Keep feature selection and parameter tuning inside the same discipline, then evaluate the finalized pipeline on untouched test data.
What interviewers listen for
- Fit learned transforms within training partitions
- Include feature selection in the boundary
- Keep the final test set untouched