How can ridge regression be reproduced as ordinary least squares on an augmented dataset?

Quick Overview

Asks how to reproduce ridge regression by running ordinary least squares on an augmented dataset. Tests understanding of the ridge objective and normal equations, how the intercept is handled, and why the construction is useful in practice.

How can ridge regression be reproduced as ordinary least squares on an augmented dataset?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How can ridge regression be reproduced as ordinary least squares on an augmented dataset? Ridge regression minimizes $\|y - Xw\|^2 + \lambda\|w\|^2$ for a design matrix $X$ of shape $n \times p$. The question asks how to add rows to $X$ and $y$ so that a plain least squares solver returns the ridge coefficients. ```hint Write the penalty as residuals A sum of squares $\lambda\|w\|^2 = \sum_j \lambda w_j^2$ can be read as squared residuals of extra observations. What would each extra observation's features and target need to be? ``` ```hint Verify it Compare the normal equations of the augmented problem with the ridge normal equations. ``` ### What a Strong Answer Covers - The exact rows added to $X$ and the matching values added to $y$ - A check that the augmented residual sum of squares equals the ridge objective, or that the normal equations match - Why the augmented problem has a unique solution even when $p > n$ - How to handle the intercept, and how the trick generalizes beyond a plain L2 penalty - Why the construction is useful in practice ### Follow-up Questions - How would you shrink the coefficients toward a nonzero prior guess $w_0$ instead of toward zero? - Can a similar augmentation reproduce the lasso? Why or why not? - Why might you solve the augmented system with a QR decomposition instead of forming $X^\top X$? - Your loss is averaged over the $n$ rows. How does that change the pseudo-rows?

Overview: Asks how to reproduce ridge regression by running ordinary least squares on an augmented dataset. Tests understanding of the ridge objective and normal equations, how the intercept is handled, and why the construction is useful in practice.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How can ridge regression be reproduced as ordinary least squares on an augmented dataset?

Ridge regression minimizes ∥y−Xw∥2+λ∥w∥2\|y - Xw\|^2 + \lambda\|w\|^2 for a design matrix XX of shape n×pn \times p. The question asks how to add rows to XX and yy so that a plain least squares solver returns the ridge coefficients.

What a Strong Answer Covers Guidance

  • The exact rows added to XX and the matching values added to yy
  • A check that the augmented residual sum of squares equals the ridge objective, or that the normal equations match
  • Why the augmented problem has a unique solution even when p>np > n
  • How to handle the intercept, and how the trick generalizes beyond a plain L2 penalty
  • Why the construction is useful in practice

Follow-up Questions Guidance

  • How would you shrink the coefficients toward a nonzero prior guess w0w_0 instead of toward zero?
  • Can a similar augmentation reproduce the lasso? Why or why not?
  • Why might you solve the augmented system with a QR decomposition instead of forming X⊤XX^\top X ?
  • Your loss is averaged over the nn rows. How does that change the pseudo-rows?