Intuition The ONE core idea
Lasso is ordinary line-fitting with a small "tax" charged on how big the weights get, where the tax is the plain sum of the sizes of the weights . Because that particular tax has a sharp corner exactly at zero, it doesn't just shrink weights — it snaps the useless ones all the way down to exactly zero , deleting features automatically.
Before you can read the parent note, you must be able to hear every symbol in it without pausing. This page walks through each one, from the most basic to the sharpest, always attaching a picture. If the parent said "the L1 norm is a diamond," this page is where the diamond is actually drawn.
Definition What a single row of data is
x i is a list of measurements about one example (one house: its size, its age, its number of rooms). y i is the single number we want to predict about that example (its price). The little subscript i just means "example number i " — the 1st, 2nd, 3rd row of a spreadsheet.
Picture a spreadsheet. Each row is one example. The columns before the last are the x values; the last column is the y value.
Intuition Why we need this
Everything in regression is about learning a rule that turns the row x i into a good guess for y i . If we can't name a single example, we can't talk about "error on that example." So ( x i , y i ) is the atom of the whole subject.
n = how many examples (rows) we have.
p = how many features (measurement columns) each example has.
Definition Weights = importance dials
A weight w j is one number that says "how strongly does feature j push the prediction up or down?" A big positive w j means "when this feature grows, the prediction grows a lot." A weight of zero means "this feature is ignored completely."
We stack all the weights into a list w = ( w 1 , w 2 , … , w p ) , one dial per feature.
w 0 and the full prediction
Besides the per-feature dials there is one extra number w 0 , the bias — a baseline offset added to every prediction, independent of any feature. It's the "starting height" of the line before any feature pushes it. The complete prediction for example i is
y ^ i = w 0 + w 1 x i 1 + w 2 x i 2 + ⋯ + w p x i p = w 0 + w ⊤ x i
The shorthand w ⊤ x i (read "w-transpose-x", but just think weighted sum ) collects only the feature part:
w ⊤ x i = w 1 x i 1 + w 2 x i 2 + ⋯ + w p x i p
The little superscript ⊤ ("transpose") is just bookkeeping that makes the multiplication line up.
Look at the figure: each blue feature value gets scaled by its yellow dial, the scaled pieces drop into one green sum, and the baseline w 0 is added on — that green number is the prediction y ^ i = w 0 + w ⊤ x i .
Intuition Why a weighted sum (plus a baseline)?
The weighted sum is the simplest rule that lets every feature have its own adjustable influence, and the bias w 0 lets the whole line float up or down to meet the data even when all features are zero. Learning the model = finding the right dial settings (and baseline) . The whole topic of Lasso is a rule for choosing those dials so that many of them end up at zero — and, importantly, Lasso taxes only the feature dials w 1 , … , w p , never the baseline w 0 (moving the baseline isn't "using a feature," so there's nothing to penalize).
Definition Error of one example
The error on example i is y i − y ^ i = y i − ( w 0 + w ⊤ x i ) : the true answer minus our guess. Positive means we guessed too low, negative means too high.
Definition Why we square it
We use ( y i − y ^ i ) 2 — the error squared — for two reasons: squaring makes every error positive (a miss is a miss whether above or below), and it punishes big misses much harder than small ones (a miss of 4 costs 16, a miss of 2 costs only 4).
The figure shows dots (real data) and a line (our guesses). Each red vertical stick is one error; we square each stick's length and add them up. A better line makes the total shorter.
Definition Mean Squared Error (MSE) and the "half" version
The true Mean Squared Error is the plain average of the squared errors:
MSE = n 1 ∑ i = 1 n ( y i − ( w 0 + w ⊤ x i ) ) 2
The big ∑ i = 1 n ("sigma") just means add up over all n examples ; dividing by n makes it an average (so more data doesn't inflate the number).
Intuition Why the topic needs this term
This is the "data fit" half of Lasso's cost. Minimizing it alone is Ordinary Least Squares (OLS) — the plain line of best fit. Lasso = data-fit plus a tax . You cannot understand the tax's effect without first knowing what it's being added to.
Definition Absolute value = size, sign thrown away
∣ w j ∣ is the distance of w j from zero , always positive. ∣3∣ = 3 and ∣ − 3∣ = 3 . On a number line, it's just "how far from the middle."
∥ w ∥ 1
Add up the sizes of all the weights:
∥ w ∥ 1 = ∣ w 1 ∣ + ∣ w 2 ∣ + ⋯ + ∣ w p ∣ = ∑ j = 1 p ∣ w j ∣
Read the double-bar ∥ ⋅ ∥ as "a single number measuring how big this whole list is." The subscript 1 names which recipe — sum-of-sizes. (The sum starts at j = 1 , so the baseline w 0 is deliberately left out — it is not taxed.)
Intuition Why sizes and not the raw numbers?
If we added the raw weights, a big positive dial and a big negative dial would cancel, and a wild model would look "small." Taking sizes first means every large dial always increases the tax , no cancelling. That is exactly the honesty we want when penalizing complexity.
Definition The other recipe: L2 norm (squared)
Ridge uses ∥ w ∥ 2 2 = w 1 2 + w 2 2 + ⋯ + w p 2 — the sum of squares instead of sizes. Same goal (measure bigness), different shape. The whole "diamond vs circle" story is about these two recipes drawing different shapes.
The figure draws, for two weights ( w 1 , w 2 ) , the set of dial settings whose tax equals a fixed budget. For the L1 recipe that set is a diamond with sharp corners sitting on the axes; for the L2 recipe it's a smooth circle . Notice: the diamond's corners are exactly the points where one weight is zero. That corner is the entire reason Lasso produces zeros — hold onto this picture, the parent note leans on it hard.
Definition The regularization strength
λ
λ (Greek "lambda") is a single non-negative number you choose: how heavy is the tax on weight-size? λ = 0 means no tax (pure OLS). A huge λ means the tax dominates and pushes all weights toward zero (the model gives up and predicts a flat baseline).
J ( w ) means
J ( w ) is the objective (also called the cost or loss ) — one single number that scores how bad a choice of weights w is. Smaller J = better weights. "Training the model" literally means searching for the w that makes J ( w ) as small as possible . The letter J is just a traditional name for this score; the "( w ) " reminds us it depends on the weights.
Intuition Why one knob controls everything
λ sets the balance between the two terms above — "fit the data" (half-MSE) versus "stay simple" (small weights). Turning it up trades a little training accuracy for a lot of simplicity. The parent note's "sweet spot," chosen by Cross-Validation , is just the best setting of this one knob.
z comes from
To see the tax's effect on a single dial, imagine we've frozen all the other weights and ask: "what should this one weight be?" With no tax, the data-fit term alone is minimized at some specific number — call it z . So z is the best value this one weight would take if there were no L1 penalty : the plain OLS answer for that coordinate.
Concretely, in the simplest decoupled setting the data-fit term for one weight w collapses to 2 1 ( w − z ) 2 (a parabola centred at z ). Its lowest point, found by setting the slope ( w − z ) to zero, is exactly w = z . That is why z deserves the name "the un-penalized target": it's the bottom of the data-fit bowl before any tax pulls it.
sign ( z )
Returns + 1 if z is positive, − 1 if negative, 0 if zero. It remembers the direction of a number while we mess with its size.
max ( a , 0 )
Returns a if a is positive, otherwise 0 . It's a floor at zero — it refuses to go negative.
Intuition Why the topic needs all three
The soft-threshold, which turns the un-penalized target z into the taxed weight w ⋆ , is
w ⋆ = S λ ( z ) = sign ( z ) max ( ∣ z ∣ − λ , 0 )
and it reads directly as: keep the original direction of z , subtract the tax λ from its size, and if that would go below zero, stop at zero. Every symbol now has a picture: z = where the bowl's bottom sits, sign = the direction, ∣ z ∣ = the distance from zero, λ = the tax, max ( ⋅ , 0 ) = the "don't cross zero" floor.
A kink is a sharp corner in a graph where it suddenly changes direction. The graph of ∣ w ∣ is a V : it comes down with slope − 1 , hits the point at 0 , and goes up with slope + 1 .
Look at the figure: the yellow V is ∣ w ∣ with its sharp corner at w = 0 , and the green rounded parabola is Ridge's w 2 . On the left the V has one steady slope (− 1 ); on the right another (+ 1 ); at the very bottom there is no single slope — that abrupt change is the kink. The parabola, by contrast, glides through zero with a smooth, gentle bottom.
Intuition Why this matters more than anything
Smooth curves have one clear slope at every point, which lets plain gradient descent work. But at the bottom of the V there is no single slope — it's − 1 on the left and + 1 on the right. That sharp bottom is a trap that catches weights and holds them at zero. Smooth penalties (Ridge's parabola w 2 ) have a gentle rounded bottom with slope zero — nothing to catch on, so weights slide past zero and never stop there. The kink is the mechanical secret behind sparsity; it's why the parent note needs special methods like Coordinate Descent and Proximal Gradient (ISTA/FISTA) instead of plain gradients.
prediction w0 plus w-dot-x
error = truth minus prediction
squared error then averaged = half MSE
L1 penalty = lambda times L1 norm
cost J = half MSE plus L1 penalty
kink at zero in the V shape
soft-threshold uses sign and max
some weights become exactly zero = Feature Selection
The map reads top-to-bottom, and it is exactly the equation from Section 5 drawn as a graph:
J ( w ) = 2 n 1 ∑ i = 1 n ( y i − ( w 0 + w ⊤ x i ) ) 2 + λ ∑ j = 1 p ∣ w j ∣
The data atom (top) builds the prediction, the prediction builds the error and half-MSE (left branch = first term); separately the absolute value builds the L1 norm which, taxed by λ , becomes the penalty (right branch = second term); their sum is the cost J ( w ) , and the kink in the V turns it into exact zeros.
Once these symbols are second nature, the parent L1 (Lasso) regularization note (or its English twin) shows the full derivation of the soft-threshold, the diamond geometry, and worked examples. Related paths: Ridge (L2) Regularization uses the circle instead of the diamond, Elastic Net blends both, and the same penalty attaches to Logistic Regression . Choosing λ is a Bias-Variance Tradeoff settled by Cross-Validation .
What does the subscript i in x i mean? "Example number i " — one row of the data spreadsheet.
What does w 0 + w ⊤ x i compute in plain words? A baseline plus a weighted sum: each feature times its dial, all added up onto the bias — the model's prediction.
What is the bias w 0 and is it taxed by Lasso? A baseline offset added to every prediction; it appears as the w 0 term in y ^ i = w 0 + w ⊤ x i and is NOT penalized.
Why do we square the error instead of just adding it? To make every miss positive and to punish big misses far more than small ones.
What does ∑ i = 1 n tell you to do? Add the following expression up over all n examples.
What is the difference between the MSE and the term used in the cost? MSE = n 1 ∑ ( ⋅ ) 2 ; the cost uses 2 n 1 ∑ ( ⋅ ) 2 , which is half the MSE — the 2 1 is cosmetic and doesn't move the minimum.
What does J ( w ) stand for? The objective / cost / loss — one number scoring how bad the weights w are; training minimizes it.
What is ∥ w ∥ 1 ? The L1 norm — the sum of the absolute values (sizes) of all the feature weights.
Why take absolute values before summing the weights? So big positive and negative dials can't cancel; every large weight always raises the tax.
What shape is the L1 budget region for two weights, and why does it matter? A diamond with corners on the axes; contours touch those corners, forcing weights to zero.
Write out the full Lasso cost J ( w ) . J ( w ) = 2 n 1 ∑ i = 1 n ( y i − ( w 0 + w ⊤ x i ) ) 2 + λ ∑ j = 1 p ∣ w j ∣ .
What does λ control? The tax rate — the balance between fitting the data and keeping weights small.
Where does z in the soft-threshold come from? It is the un-penalized (OLS) value a single weight would take with no tax — the bottom of that coordinate's data-fit bowl 2 1 ( w − z ) 2 .
Read sign ( z ) max ( ∣ z ∣ − λ , 0 ) in words. Keep the sign/direction, subtract the tax from the size, and clamp to zero if it would go negative.
Why does ∣ w ∣ cause trouble at zero? Its V-shape has a kink — no single slope at zero — so plain gradient descent can't cleanly land there.