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§
- Lasso
Model - A fitted lasso model.
Functions§
- fit
- Fit lasso with penalty
lambda ≥ 0by coordinate descent.lambda = 0reduces to OLS (up to the iteration tolerance). Fails closed on shape mismatch /n < 2.