Lesson 7 of 9 9 min · 130 words
Overfitting and regularization in regression
Polynomial features, and Ridge/Lasso to tame them.
Polynomial regression adds powers of the features — — and fits a linear model on them. A higher degree can fit curves, but with high and little data, the curve wiggles through every point and generalises badly.
The classic demo: 10 noisy points from a sine wave. Degree 1 underfits (a line); degree 3 captures the shape; degree 9 hits every point exactly with zero training error and wild swings between them.
Ridge (L2) shrinks the coefficients and smooths the curve; lasso (L1) can zero out unnecessary polynomial terms. Both are controlled by , chosen by cross-validation.
Formula to remember
R²
Fraction of variance explained; 1 is perfect.
Quick check · +5 XP