Regularization adds a preference or constraint to a learning problem. A penalty on large coefficients can reduce sensitivity to the training data, while also changing which solution the optimizer seeks.
Worked example
In ridge regression, the objective combines squared prediction errors with a nonnegative multiple of the sum of squared coefficients. A larger penalty makes large coefficients more expensive. This can stabilize estimates when features are strongly correlated, although it can also introduce bias and reduce fit to the training observations.
What to check
Select the penalty strength using an appropriate validation procedure. Keep the final test set available for an independent assessment. Feature scaling matters because the same coefficient penalty has a different effect when a feature’s units change. Also state whether the intercept is penalized. Regularization is part of the model definition, so reproduce its exact convention when comparing results between libraries or deployments.
Continue with the book
Explore the full treatment, worked examples, and exercises in Mathematics for AI and Machine Learning.
Companion article for Mathematics for AI and Machine Learning, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
