Lesson 5.6 · 8 min read · about 50 min to master at a very slow pace

Understanding λ (Lambda)

What happens at λ = 0, small, intermediate, large and infinite λ. Why regularisation never beats OLS on training error, and how bias, variance and coefficients move along the way.

Not startedJump to quiz

The regimes of λ

λCoefficientsTraining errorBias / varianceTypical test error
0OLSMinimum possibleLowest bias, highest varianceHigh if overfitting
SmallSlightly shrunkRises a littleVariance fallsOften falls
IntermediateModerately shrunk (LASSO: some zero)HigherBalancedBest (chosen by CV)
LargeHeavily shrunkHighHigh biasRises again
All slopes → 0 (LASSO: exactly 0 beyond a finite λ)= TSS (predicts )Pure biasUnderfitting

When is training error lowest?

At . With no penalty, ridge and LASSO both reduce to OLS, which by definition minimises RSS. Training error then increases (weakly) as grows. Regularisation buys better test error with extra bias; it never beats OLS on the training data.

Training loss vs penalised objective

For each λ, the regularised solution minimises RSS + penalty, so it beats OLS on that objective. But OLS beats it on plain RSS. If a question asks about "training error", it means RSS/MSE.

Coefficient paths

-1012302468λ
Ridge: every coefficient shrinks smoothly toward 0 but never reaches it.
-1012302468λ
LASSO: coefficients hit exactly 0 one after another (0.4 first, then 1.2, then −1.5) and stay there.

OLS coefficients 3 (teal), −1.5 (coral), 0.4 (amber) and 1.2 (violet), orthonormal design.

The order in which LASSO drops variables is a rough ranking of importance: the coefficients that survive longest matter most. In practice is plotted on a log scale.

Interpreting a change in λ

Training MSE is 0.8 at and 1.1 at ; test MSE is 3.0 at and 1.9 at . The unpenalised model overfits: the penalty raised training error slightly but cut test error substantially, by reducing variance.

Across many random training sets, regularised models give more consistent coefficients (less variable), at the price of bias. The net effect on prediction is best at an intermediate λ.

Cheatsheet

λ regimes

λ=0: OLS, min training error. Small: slight shrink, test often ↓. Middle: best (CV). Large: high bias. ∞: predicts .

Lowest training error?

Always at λ = 0. Regularisation never beats OLS on training RSS.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1conceptFor which value of does a regularised regression achieve its lowest training error?
Q2conceptRidge regression with is...
Q3interpretTraining MSE goes from 0.8 to 1.1 and test MSE from 3.0 to 1.9 as rises from 0 to 5. How do you read this?
Q4conceptCompared with OLS, the ridge solution for some has...
Q5interpretIn a LASSO path, the coefficient for variable A hits zero at and the one for B at . What does this suggest?