Ridge Regression and Directional Shrinkage
Derive how a squared coefficient penalty changes the normal equations and shrink poorly determined feature directions more strongly.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Add a cost on coefficient magnitude
Ridge minimizes \(\|X\beta-y\|_2^2+\lambda\|\beta\|_2^2\) for \(\lambda>0\), with a separate convention for any intercept. The coefficient matrix in the stationary equations becomes \(X^\top X+\lambda I\). This matrix is positive definite on the penalized coordinates under the usual setup. If a data direction has very small singular value, adding \(\lambda\) prevents that direction from being amplified as strongly as in ordinary inversion.
Scaling features changes which solutions are cheap
For one centered feature with \(\sum_i x_i^2=4\) and \(\sum_i x_iy_i=8\), ordinary least squares gives two. With \(\lambda=4\), ridge gives one. Rescaling the feature changes its penalty for making the same predictions, so choose scale using training data and preserve the fitted transform. Bias and variance give the tradeoff. Lasso uses a different penalty geometry.[1][2]