Chapter 2

Ridge regression

Ridge adds a squared coefficient penalty to a linear prediction model. It reduces sensitivity to poorly determined directions, while introducing bias. The intercept is usually left unpenalised.

2.1 Objective, intercept and solution

Let X∈Rn×d\mathbf X\in\mathbb R^{n\times d} have rows xi⊤\mathbf x_i^\top, y\mathbf y collect the targets, w\mathbf w be the coefficient vector and bb the intercept. Centre each feature and the target using training means xˉ\bar{\mathbf x} and yˉ\bar y; write the centred arrays as Xc,yc\mathbf X_c,\mathbf y_c.

If the model explicitly has no intercept, use X,y\mathbf X,\mathbf y directly without centring. Penalising an augmented intercept coefficient is a different problem. For heterogeneous physical feature units, scale features first so that the isotropic penalty has a meaningful interpretation.

2.2 Shrinkage and prediction variance

Past papers · DA 2024–2026 (3 papers): 1 question, 2 marks

Use the compact SVD Xc=USV⊤\mathbf X_c=\mathbf U\mathbf S\mathbf V^\top, with positive singular values sjs_j on the diagonal of S\mathbf S and rank rr. Singular-value algebra: see Engineering Mathematics.

As λ→0+\lambda\to0^+, the solution approaches the minimum-norm least-squares solution. As λ→∞\lambda\to\infty, coefficients tend to zero; an unpenalised intercept tends to yˉ\bar y. Directions with smaller sjs_j are shrunk more strongly. Individual coefficients need not decrease monotonically in magnitude when predictors are correlated; the total coefficient norm is nonincreasing with λ\lambda.

Last-minute recall

  • Ridge uses a squared L2L_2 penalty.
  • Centre the data to leave the intercept unpenalised.
  • Positive regularisation makes the coefficient system invertible.
  • Loss normalisation changes the numerical regularisation parameter.
  • Shrinkage reduces noise amplification along small-singular-value directions.
  • A smaller variance does not guarantee a smaller total prediction error.

Revise offline: the whole Machine Learning handbook as one PDF

42 pages · 1.8 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections