← All STAT 413 applets

Ridge Regression

Ridge regression fits a degree-8 polynomial to a real, standardized dataset (simple_data.csv) while adding an \( \ell_2 \) penalty \( \tfrac{\lambda}{2}\sum_j \beta_j^2 \) to the squared-error loss. Drag the λ slider: as λ grows, every coefficient is smoothly shrunk toward zero (but never exactly to zero), the fitted curve flattens, and the solution moves inside a circular constraint region. The intercept \( \beta_0 \) is never penalized.

Coefficient paths vs λ

Data & fitted curve

5-fold CV error vs λ

Geometric view (β₁, β₂)

Regularization
slider starts at the cross-validation optimum; right = more flexible (smaller λ), left = more regularized (larger λ).