For ridge regression, define the effective degrees of freedom df⁡(λ)=tr⁡(X(X⊤X+λI)−1X⊤) and express it with the singular values dj of X. If X has singular values 4,2,1 and λ=4, what are df⁡ and the shrinkage factor on each direction?

Supervised learning, Ridge regression
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can use the SVD to see ridge as shrinking each principal direction by dj2/(dj2+λ).

Key idea

With X=UDV⊤, df⁡(λ)=∑jdj2dj2+λ. Directions with large dj are barely shrunk, while directions with small dj are shrunk heavily.

Steps

  1. Write the SVD X=UDV⊤, with orthonormal U, V and diagonal D of singular values dj.
  2. Substituting, the ridge fitted values are y^=Xβ^=U D(D2+λI)−1D U⊤y=∑jujdj2dj2+λuj⊤y. So the component of y along uj is multiplied by dj2/(dj2+λ).
  3. The trace of the smoother matrix adds these factors: df⁡(λ)=∑jdj2/(dj2+λ). At λ=0 it is p (here 3), and it tends to 0 as λ→∞.
  4. Numbers with d2=16,4,1 and λ=4: factors are 16/20=0.8, 4/8=0.5, 1/5=0.2.
  5. So df⁡(4)=0.8+0.5+0.2=1.5, fewer than the 3 parameters.
  6. Interpretation: ridge keeps the high-variance (large dj) directions almost fully and suppresses the directions that the data barely inform, which is why it controls variance.

Common mistakes

How long your answer should be

Half a page, 5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: How do you derive the log-likelihood, the gradient and the Hessian of binary logistic regression, show that the log-likelihood is concave, and carry out one Newton step from w=0 on the data x=(1,2,−1), y=(1,1,0) (one feature, no intercept)?
Next in Supervised learning: Assume y=Xβ+ε with E[ε]=0, Cov⁡(ε)=σ2I and X of full column rank p. How do you prove that E[RSS]=(n−p)σ2, so that σ^2=RSS/(n−p) is unbiased?