Ridge Regression
Ridge regression controls the modulus of the weight: we use Mean Squared Error plus L2 Regularization as the Cost Function
We get as ; and as .
Then with the same process, we get

Above is an illustration. Ridge regression seeks an equilibrium between the weight norm and the MSE.
The math relationship between and is derived in Weight Decay, where and ; is the eigenvalue decomposition/SVD. Furthermore, let , we have
Therefore, ridge regression is more stable than Linear Regression.
Also, we can see that L2 Regularization causes the learning algorithm to “perceive” the input as having a higher variance, which makes it shrink the weights on features whose covariance with the output target is low compared to this added variance.
In the above example, the components of corresponding to the first dimension has lower variance (or the eigenvalue of the Hessian of is small in this direction); thus, the objective function does not increase much when moving horizontally away from . Then the regularizer pulls close to zero. In the second dimension, the situation is reversed, pulling away from zero.
Pseudoinverse
As we can see, if we let , then we get
where is the Moore-Penrose Pseudoinverse. Therefore we can interpret the pseudoinverse as stabilizing underdetermined problems using regularization.
Variance, Correlation, Singular Value, and Weight
First, the variance of the random vector is a Covariance matrix. And the sample Covariance matrix is . For highly correlated data, i.e., some features are dependent, some non-diagonal elements of the covariance matrix will be big. Also, if the data is correlated, some eigenvalues of or singular values of will be small.
Back to the illustrative graph above. We know that
and
which is zero at . Therefore, we need to examine the Hessian of , which is , the scaled sample Covariance matrix.
So the sample Covariance matrix determines the curvature of at . And is more sensitive in directions of corresponding to larger eigenvalues of , or larger singular values of , which captures larger variance of the data.
Then, with regularization, ‘s direction with a smaller variance will be pull to zero more quickly.
Bias and Variance
where .
Compared to the variance of :
the variance of shrinks by a factor of .Link to original\begin{aligned} \Var\[w\_{\mathrm{MLE}}] \=& \mathbb{E}\[w\_{\mathrm{MLE}}w\_{\mathrm{MLE}}^{T}] - \mathbb{E}\[w\_{\mathrm{MLE}}]\mathbb{E}\[w\_{\mathrm{MLE}}]^{T}\\ \= & \mathbb{E}\left\[\left(X^T X\right)^{-1} X^T Y Y^T X\left(X^T X\right)^{-1}\right]-w w^T \\ \= & \left(X^T X\right)^{-1} X^T \mathbb{E}\left\[Y Y^T\right] X\left(X^T X\right)^{-1}-w w^T \\ \= & \left(X^T X\right)^{-1} X^T (\Var(Y) + \mathbb{E}\[Y]\mathbb{E}\[Y]^{T}) X\left(X^T X\right)^{-1}-w w^T \\ \= & \left(X^T X\right)^{-1} X^T\left(\sigma^2 I+X w w^T X^T\right) X\left(X^T X\right)^{-1}-w w^T \\ \= & \left(X^T X\right)^{-1} X^T \sigma^2 I X\left(X^T X\right)^{-1}+ \\ & \left(X^T X\right)^{-1} X^T X w w^T X^T X\left(X^T X\right)^{-1}-w w^T \\ \= & \sigma^2\left(X^T X\right)^{-1}\\ \= & \sigma^{2}V\Sigma ^{-2}V^{T}, \end{aligned}
Least Squares vs. Ridge Regression
- Least squares solution: unbiased, but potentially high variance
- Ridge regression solution: biased, but lower variance than LS
For general bias and variance trade-off, see Bias-Variance Trade-Off.