From the book Hands-On Machine Learning:

Note that the regularization term should only be added to the cost function during training. Once the model is trained, you want to use the unregularized performance measure to evaluate the model’s performance.

Why wouldn't you use the same model for both training and testing?

  • 1
    $\begingroup$ You are using the same model for both training and testing; the quote is about the performance metric used to evaluate that model. When doing model evaluation, you shouldn't evaluate your model and add the regularization term's penalty to that evaluation. $\endgroup$
    – jbowman
    Commented Jan 5, 2020 at 3:22

1 Answer 1


I think there is a slight confusion.

What the author means is that during testing we focus on the MSE as this is what we evaluate performance on. The MSE plus the regularisation penalty is what we use to fit the model with. We are using the "same model"; just what we measure during training and testing is not the same. During training we evaluate the goodness-of-fit on known data and penalising model complexity at the same time, while during testing we evaluate goodness-of-fit on unknown data and assume that this performance generalises further.


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.