LASSO
LASSO stands for least absolute shrinkage and selection operator. It estimates a linear predictor while penalizing the sum of the absolute coefficient values. Unlike the quadratic ridge penalty, the absolute value penalty has a corner at zero, which can make an exactly zero coefficient optimal.
The estimation problem¶
With centered training data, solve
The intercept is restored on the original scale using . If predictors were also scaled, first convert slopes back to their original units.
Penalty comparisons depend on predictor scale. A variable measured in thousands may need a much smaller coefficient than the same variable measured in units. Standardizing slopes puts their penalties on a comparable footing. Learn the scaling from the training sample, including separately within each validation fold.
Constrained geometry¶
An equivalent constrained problem minimizes residual error subject to , with a corresponding choice of for a penalized solution. Larger imposes stronger shrinkage; larger allows a larger coefficient budget.
In two dimensions the LASSO constraint is a diamond with corners on the coordinate axes. Elliptical residual contours can first touch a corner, setting one coefficient to zero. The ridge constraint is smooth, so it has no comparable corner favoring exact zeros.
This is a tendency rather than a guarantee that ridge coefficients can never equal zero. Symmetry or particular data can make a ridge coefficient zero. Ridge simply does not usually create sparsity by a threshold mechanism.
Optimality at a corner¶
For a scalar , the subgradient of is 1 if , if , and any value in if . A subgradient supplies the supporting slopes where an ordinary derivative does not exist.
Let . Convex optimality requires
There are two cases:
If , then .
If , then .
A zero coefficient is therefore compatible with a whole interval of residual correlations. It need not have exactly zero correlation with the response.
An orthogonal calculation¶
When , the problem separates into independent coordinates. Write . Then
For and , the fitted coefficients are . The middle coordinate is removed, while the other two move toward zero by one unit. This calculation is illustrative, rather than an output from the supplied datasets.
For correlated predictors, the relevant quantity changes as the other coefficients change. Applying this formula independently to the raw correlations is not the general solution; coordinate descent handles that dependence.
Correlation and uniqueness¶
The objective is convex, so its optimality conditions characterize global minima. Coefficients need not be unique when the design is rank deficient. For positive , all minimizers nevertheless have the same fitted vector , because squared loss is strictly convex in that vector.
Strongly correlated predictors may substitute for one another. A small sample change can alter which is retained while leaving predictions similar. Sparse prediction and reliable scientific variable identification are different objectives.
Usage
Many candidate predictors with a plausible sparse linear signal.
A compact predictive formula is useful.
Explicitly constructed nonlinear terms or interactions need regularization.
Limitations
Selection can be unstable among correlated predictors.
Nonzero coefficients remain biased by shrinkage.
Unspecified nonlinear relationships are not discovered automatically.
Selection alone does not justify ordinary significance tests on the retained variables.