Penalties that shrink
Regularisation adds a penalty to a fitting loss so that large coefficients cost something: . Ridge uses and the lasso uses . This is an optimization problem like any other, and it has an equivalent constrained form, loss subject to , in which is exactly the KKT multiplier of the budget . A larger means a smaller budget.
The one-variable problems show the difference. Ridge divides the unpenalised value by : every coefficient shrinks by the same proportion but none reaches zero. The lasso subtracts from and clips at zero, so every coefficient with becomes exactly zero. This is why the lasso selects variables. Geometrically, the ball has corners on the axes and the loss contours tend to touch it at a corner, while the round ball has no corners. Analytically, has a kink at zero where the slope jumps from to , and a minimum can sit on that kink.
In finance the ridge penalty stabilises regressions on correlated predictors, a cousin of covariance shrinkage, and the lasso builds sparse index-tracking portfolios. One trap: in a long-only, fully invested portfolio , so the penalty is the constant and changes nothing. To get few non-zero positions or few trades, penalise the trades , which is exactly what turnover and cost limits do in the capstone. In Bayesian terms ridge corresponds to a Gaussian prior on the coefficients and the lasso to a Laplace prior.
- Ridge: in one variable; shrinks smoothly, never exactly to zero.
- Lasso: soft threshold ; sets small coefficients exactly to zero.
- Constrained form: penalty weight is the KKT multiplier of the budget .
A bigger trades variance for bias: coefficients get smaller and more stable but systematically pulled toward zero. Pick by cross-validation or a walk-forward test, never by the in-sample fit, which always prefers . With time series use blocks that respect time order.
Lab · what's graded
8 tasks · 100 pts- A lasso coefficient10 pts
- A ridge coefficient10 pts
- A coefficient set to zero15 pts
- A one-variable ridge regression15 pts
- Why the lasso makes exact zeros15 pts
- A useless penalty15 pts
- Priors and effects10 pts
- What a larger lambda does10 pts