2.2.15 · D3Linear & Logistic Regression

Worked examples — Elastic Net regularization

2,144 words10 min readBack to topic

Before we start, let us make sure every symbol is earned.

Figure — Elastic Net regularization

Look at the figure: the input comes in on the horizontal axis, the output leaves on the vertical. The flat red segment in the middle is the L1 dead zone; the slope of the sloped part (less than ) is the L2 squish. Every example below is just "where does my land on this graph?"


The scenario matrix

Every input to the update belongs to one of these cells. Our job is to hit them all.

Cell What varies Example
A. Positive, survives , Ex 1
B. Negative, survives , (sign flows through) Ex 2
C. Killed (inside dead zone) → exactly Ex 3
D. Boundary / degenerate exactly, or Ex 4
E. limit (pure Lasso) divisor , only threshold acts Ex 5
F. limit (pure Ridge) no dead zone, only divisor acts Ex 6
G. Correlated group (grouping effect) two equal features share weight Ex 7
H. Real-world word problem build , apply update, interpret Ex 8
I. Exam twist () limiting behaviour of both knobs Ex 9

Cell A — positive feature that survives


Cell B — negative feature (sign carries through)


Cell C — weak feature killed inside the dead zone


Cell D — the exact boundary and the zero input


Cell E — pure Lasso limit ()


Cell F — pure Ridge limit ()


Cell G — correlated group, the grouping effect

Figure — Elastic Net regularization

The figure shows the flat trench along (where data-fit + L1 are indifferent) and the L2 bowl whose lowest point on that trench sits dead-center at .


Cell H — real-world word problem


Cell I — exam twist: limiting behaviour as


Which knob should you actually pick?


Active recall

Recall Predict the cell before revealing

If and , is zero? ::: Yes — , inside the dead zone (Cell C/D), so . With , can any weight be exactly zero from the update alone? ::: No — threshold is , so soft-thresholding never kills; only a divisor shrinks (Cell F). Two identical features, total desired weight — Elastic Net split? ::: — the L2 term minimizes at equality (Cell G). As with any fixed , every ? ::: — the model collapses to intercept-only (Cell I).


Connections