Expand description
Ridge regression (ISL ch 6.2.1, PRML ch 3) — L2-penalized least squares.
Minimise ‖y − Xβ‖² + λ‖β‖² (the intercept is not penalized). Centering y
and the predictors removes the intercept from the penalized solve, leaving
(XcᵀXc + λI)β = Xcᵀyc, solved with linear_algebra::cholesky (the penalty
makes the system positive-definite even for collinear predictors — ridge’s whole
point). Kernel-class DenseLinear, dispatch-ready.
Structs§
- Ridge
Model - A fitted ridge model: slope coefficients (predictor-aligned) plus an un-penalized intercept.
Functions§
- fit
- Fit ridge regression with penalty
lambda ≥ 0.lambda = 0reproduces OLS. Fails closed on shape mismatch /n < 2.