Why should a scaler be fit_transform on the training set but only transform the test set?
Correct answer
C. Fitting on test data leaks its statistics into training
16 views
C. Fitting on test data leaks its statistics into training
16 views
Calling fit on the test set would compute the mean and standard deviation from data the model is supposed to be evaluated on, leaking information and inflating test scores. The correct sequence learns the parameters on training data once and applies that same mapping with transform to validation and test data. This is the most common example of data leakage, and it is why preprocessing belongs inside a Pipeline.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.