The elastic net minimises ∥y−Xβ∥2+λ2∥β∥22+λ1∥β∥1. How do you show that it is a lasso problem on augmented data, and what does this imply for the number of variables it can select and for correlated features?

Supervised learning, Elastic net
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

A neat reduction: the ridge part is absorbed by adding p pseudo-observations, giving a lasso with n+p rows.

Key idea

Let c=(1+λ2)−1/2 and X∗=c(Xλ2Ip), y∗=(y0). Then ∥y∗−X∗β∗∥2=∥y−Xβ∥2+λ2∥β∥2 when β∗=β/c.

Steps

  1. Stack the data: X∗=c(Xλ2I) (size (n+p)×p), y∗=(y,0), and define β∗=β/c, so X∗β∗=(Xβ, λ2β).
  2. Then ∥y∗−X∗β∗∥2=∥y−Xβ∥2+∥λ2β∥2, which equals the squared-error part plus the ridge part.
  3. The L1 term is λ∗∥β∗∥1=(λ∗/c)∥β∥1. Choosing λ∗=cλ1=λ1/1+λ2 makes it equal to λ1∥β∥1. So elastic net on (X,y) is exactly lasso on (X∗,y∗).
  4. Number of variables: a lasso on n rows picks at most n non-zero coefficients. The augmented matrix has n+p rows and full column rank p for any λ2>0, so the elastic net can select up to p variables, even when p>n.
  5. Correlated features: for two nearly identical columns, lasso tends to pick one at random. The ridge term is strictly convex, so the solution is unique, and equal-looking columns receive nearly equal coefficients (the grouping effect).
  6. Rule of thumb: use the elastic net when features come in correlated groups, or when p≫n and you expect many relevant features.

Common mistakes

How long your answer should be

One page; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: Fit the points (0,1),(1,3),(2,3) with (a) a quadratic y=a+bx+cx2 and (b) a straight line. Find each fit and its residual sum of squares. Why is the quadratic exact, and what goes wrong if you try a cubic?
Next in Supervised learning: Show that ridge regression is the MAP (maximum a posteriori) estimate under a Gaussian prior, and lasso under a Laplace prior, when the noise is Gaussian. If the noise variance is σ2=2 and the prior is βj∼N(0,τ2) with τ2=0.5, what ridge λ does this give?