Ridge regression shrinks correlated predictors toward each other, but it never drops one entirely — no matter how large the penalty, both weights stay some nonzero decimal. What would it take for a regularizer to actually decide "this predictor isn't worth keeping" and set its weight to exactly zero?
Same two nearly-identical predictors as the ridge chapter. Push λ up and, past a small threshold, doesn't just shrink toward zero the way ridge's would — it lands exactly on it and stays there.
Lasso swaps ridge's squared penalty for an absolute-value one:
- MSE() — mean squared error (lasso conventionally penalizes the averaged error, not the raw sum ridge uses — so the same numeric λ lands at a different effective strength for each).
- — the penalty strength, same role as in ridge.
- — the absolute value of the -th weight — the source of everything that follows.
Unlike ridge, this loss has no closed form — it's minimized by cyclic coordinate descent: repeatedly pick one weight, hold the others fixed, and solve for it via soft-thresholding, .
- A squared penalty is smooth at zero; an absolute-value one has a corner
has zero slope at , so shrinking a weight that's already small barely pulls it further. has a constant-slope kink at — that corner is what a coordinate update can land exactly on.
- Soft-thresholding is the algebraic form of that corner
Solving the 1D optimality condition for one weight at a time gives exactly the soft-threshold rule: if the weight's "signal" is smaller in magnitude than , the optimal weight is precisely — not close to it.
- Correlated predictors can make lasso's choice unstable
When two predictors carry almost the same signal, which one gets zeroed can depend on arbitrary details like update order — a real quirk of lasso under collinearity, and the reason ElasticNet exists (next chapter).
Same λ, fed to both penalties on the same data. Lasso routinely shows a flat for ; ridge, right below it, never does — its is always some nonzero decimal, however small.
Same toy setup as ridge: , (correlation ), .
- Unregularized, lasso agrees with OLS
At , coordinate descent converges to the same unstable fit as before: , .
- A tiny penalty already zeroes w2 (λ = 0.03)
The soft-threshold cutoff is . Starting from :
- (since ), so
- — inside the dead zone , so exactly
Plugging back into step 1 reproduces the same , so this is already the fixed point — absorbs essentially the whole fit.
- It stays exactly zero across a wide range (λ = 0.5)
The cutoff is now — much wider. Starting from :
- , so
- — still inside the wider dead zone , so
Again a fixed point immediately: lasso has picked predictor 1 and permanently discarded predictor 2, a form of automatic feature selection ridge structurally cannot do.
Increase λ until w₂ drops to exactly zero.
Lasso's penalty has a corner at zero that ridge's smooth doesn't — and coordinate-wise optimization tends to land exactly on that corner. The result is automatic feature selection: past a threshold λ, a weak predictor's weight isn't just small, it's exactly .