Skip to main content

Module lasso

Module lasso 

Source
Expand description

Lasso regression (ISL ch 6.2.2) — L1-penalized least squares by cyclic coordinate descent with soft-thresholding.

Minimise ½‖y − Xβ‖² + λ‖β‖₁ (intercept not penalized; handled by centering). Unlike ridge, the L1 penalty drives some coefficients exactly to zero (variable selection). Coordinate descent updates one βⱼ at a time via the soft-threshold operator, keeping a running residual for O(np) per sweep. Scalar fit-loop → CPU (the per-coordinate dot is Reduction-class).

Structs§

LassoModel
A fitted lasso model.

Functions§

fit
Fit lasso with penalty lambda ≥ 0 by coordinate descent. lambda = 0 reduces to OLS (up to the iteration tolerance). Fails closed on shape mismatch / n < 2.