← All STAT 413 applets

LASSO

The LASSO fits a degree-8 polynomial to a real, standardized dataset (simple_data.csv) while adding an \( \ell_1 \) penalty \( \lambda\sum_j |\beta_j| \) to the squared-error loss. Drag the λ slider: as λ grows, the soft-threshold update drives coefficients to exactly zero (sparsity), the fitted curve simplifies, and the solution moves toward the corners of a diamond-shaped constraint region — which is precisely why the LASSO selects variables. 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 λ).