Statistical Decision Theory and Bayesian Learning · Machine Learning

Ridge Regression

Watch lectures

Ridge Regression

1. Problem It Fixes

OLS explodes when features correlate or d>nd > n (XTXX^{T}X singular). Ridge adds L2L₂ penalty:

J=∣∣y−Xw∣∣2+λ∣∣w∣∣2J = ||y - Xw||² + λ ||w||²

λ≥0λ ≥ 0 controls shrinkage. Larger λλ → smaller, stabler ww.

2. Closed Form

w=(XTX+λI)−1XTyw = (X^{T} X + λ I)^{-1} X^{T} y

λIλI makes matrix invertible even when XTXX^{T}X is singular. Bayesian view: Gaussian prior on ww (MAP).

3. Effect

λλ Behaviour
00 OLS (may overfit)
small stabilizes, tiny bias
large heavy shrinkage, may underfit

Ridge shrinks but never zeroes — keeps all features. Use cross-validation to pick λλ.

4. Worked Intuition

two almost-identical features → OLS gives +1000, -999 (cancels)
Ridge λ=1 → gives +2.1, +1.9 (stable, small)

5. Exam Points

  • Write objective + solution — 5-7 marks, very frequent.
  • Why λIλI fixes singularity — 3 marks, frequent.
  • Ridge vs OLS, role of λλ — 3 marks, frequent.
Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.

← All Machine Learning modules