Which practice prevents train-test contamination during preprocessing?
- A Splitting the data first and fitting scalers and encoders on the training split only
- B Scaling the whole dataset before splitting
- C Using the same random seed
- D Normalising the target variable
Answer
Splitting the data first and fitting scalers and encoders on the training split only
Using a scikit-learn Pipeline fits preprocessing inside each cross-validation fold automatically, eliminating this class of error structurally.





