CONCEPT 23 / Generalization / Restraining a model
Regularization.
Constrain model weights with a penalty budget. Watch the 3D constraint boundary pull the solution away from noisy overfitting toward a smooth, generalizable fit.
Where the loss bowl meets the penalty boundary
Sweep penalty λ and switch between Ridge (L₂ sphere/circle) and Lasso (L₁ diamond) to see how weight constraints tame overfitting.
01 / Interactive visualLoaded example
Loss bowl + shrinking L₂/L₁ constraint cage + 3D curve ribbon
Fitted polynomial curve & 2D weight-space constraint geometry
Left in 3D: the elliptical data-loss bowl meets the penalty cage around the origin. Right in 3D: the fitted polynomial ribbon smooths out as λ grows.
Generalization U-curve across penalty λ
Training MSE vs Holdout MSE as penalty λ increases
Why it matters
Regularization trades a small rise in training error for a much smoother, more reliable model on unseen data.
L₂ (Ridge) shrinks correlated weights smoothly toward zero; L₁ (Lasso) has sharp axis corners that snap weak weights all the way to 0.