Least squares: ฮฒ minimizes ฮฃ(y โˆ’ ลท)ยฒ, solved via the normal equations (Xแต€X)ฮฒ = Xแต€y.
Ridge (L2): minimizes ฮฃ(y โˆ’ ลท)ยฒ + ฮปฮฃฮฒแตขยฒ โ†’ closed form (Xแต€X + ฮปI)โปยนXแต€y โ€” shrinks all coefficients smoothly.
Lasso (L1): minimizes ฮฃ(y โˆ’ ลท)ยฒ + ฮปฮฃ|ฮฒแตข| โ€” solved by coordinate descent with soft-thresholding, which can drive coefficients to exactly zero (automatic feature selection).
The bottom chart plots training error (blue) and held-out test error (orange) against polynomial degree at the current regularization โ€” the classic bias-variance U-curve.