Regularization

Training techniques that reduce overfitting and help a model generalize better.

Why accept a slightly worse training fit?

A toy fitting rule adds the training error to 0.1 times the sum of squared coefficients. Two candidate models use features on the same scale. The report below gives their training errors and coefficient penalties separately.

CandidateTraining errorSum of squaresTotal objective
A2.092.9
B2.212.3

Which candidate does the objective favor?

Candidate B has a slightly larger training error but the smaller total, 2.2 + 0.1 × 1. The regularizer changes the criterion used in fitting. It encodes a preference for smaller coefficients in this example. Other regularizers express other preferences.

Two flexible splines are pinned to a drafting jig.
A fitting rule can reward agreement with the observations while also limiting complexity.

When does the preference help?

Check prediction error on held-out observations across several penalty strengths. A strong penalty can suppress real structure, while a weak one can leave the fit sensitive to noise. Scaling the inputs changes coefficient magnitudes, so record preprocessing alongside the chosen strength.

Follow the idea

Overfitting · Recognize fits that do poorly on new examples.

Validation Set · Compare candidate penalty strengths on development data.

Source · Scikit-learn on ridge regression and its penalty

Return to Regularization in the A–Z glossary