We know that it's better to standardization the training data (i.e. X_train) before fitting a LASSO model, especially when features are not in the same scale (Ref. Is standardisation before Lasso really necessary?).

But after fitting a LASSO model, when doing the prediction with the new data, do we still need to rescale the testing data (i.e. X_test)? And if so, how to properly to rescale the unseen future data?


1 Answer 1


Yes, you should scale the test data, and you should do so according to the rules you developed on the training data. For instance, if you scale by subtracting the mean and then dividing by the standard dviation, do this to the test data by using the mean and standard deviation from the training data, not from the test data. Otherwise, there is leakage.

The reason to scale your features after you fit the LASSO model is beause the scaling is, essentially, a unit conversion. The original features are in the original units; scaling by the mean and standard deviation puts the values in units of standard deviations from the mean. You wouldn't want to regard centimeters and miles to be the same units, would you? The same idea applies here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.