How L1 Regularization Forces Coefficients to Zero While Ridge Regression Keeps Them All
While both techniques prevent machine learning models from overfitting, Lasso regression uniquely performs feature selection by mathematically eliminating less important variables entirely.
By Mateo Ramos
- Predictive Accuracy Advocates
- Argue that minimizing overall prediction error is paramount, favoring Ridge regression to retain all available signal.
- Interpretability Advocates
- Prioritize sparse models where humans can understand exactly which variables drive the prediction, favoring Lasso.
- Hybrid Practitioners
- Argue that combining both penalties via Elastic Net solves Lasso's instability with correlated variables while maintaining sparsity.
Perspectives this story doesn't cover
- Computational hardware engineers optimizing chip architecture for sparse matrices
Summary
- Ridge regression shrinks all coefficients proportionally but keeps every variable in the final model.
- Lasso regression applies an absolute-value penalty that forces less important coefficients to exactly zero.
- This zeroing effect makes Lasso an automatic feature selector, ideal for high-dimensional datasets.
- Lasso struggles with highly correlated variables, often arbitrarily keeping one and dropping the rest.
Ridge regression prevents a model from memorizing noise by shrinking the influence of every variable proportionally. If a dataset has 10,000 predictors, Ridge returns a model with 10,000 slightly muted predictors. Lasso regression differs in one fundamental respect: it shrinks the influence of variables by a constant amount, which forces the least important ones exactly to zero. Introduced in 1996 by Stanford University statistician Robert Tibshirani, the method was designed to solve the interpretability problem of massive datasets.[3][7]
The mechanism behind this difference lies in the shape of the mathematical penalty each method applies to the model's coefficients. Ridge regression, formalized in 1970, penalizes the sum of the squared coefficients. This creates a smooth, circular constraint region in the geometric space of the data. The optimal solution—where the model's error meets this constraint—almost always lands on the curve of the circle, meaning all variables retain some non-zero value.[3][5][8]
Lasso applies a different mathematical constraint. As researchers at the Columbia University Mailman School of Public Health note, "LASSO is a regression analysis method that performs both variable selection and regularization in order to enhance the prediction accuracy and interpretability." It achieves this by penalizing the sum of the absolute values of the coefficients. Geometrically, this creates a diamond-shaped constraint region with sharp corners.[2][4][5]
When the model seeks the optimal solution under an L1 penalty, the mathematical intersection overwhelmingly occurs at one of these sharp corners, which sit exactly on the axes of the geometric space. Landing on an axis means the coefficient for that specific variable is exactly zero, effectively dropping it from the equation. A Ridge model's circular boundary lacks these corners, making an axis intersection statistically improbable.[3][5][6][8]
Landing on an axis means the coefficient for that specific variable is exactly zero, effectively dropping it from the equation.
This property transforms Lasso from a simple regularization tool into an automatic feature selector. In fields like bioinformatics, researchers often feed models 20,000 gene expression levels to predict a single disease outcome. A Ridge model would assign a tiny weight to every gene, leaving researchers to guess which ones actually matter. A Lasso model will drop 19,950 irrelevant genes entirely, leaving a sparse, interpretable model containing only the 50 most predictive markers.[2][4][7]
However, the L1 penalty carries specific limitations when dealing with highly correlated variables. If three variables move in perfect lockstep—such as a patient's weight in pounds, weight in kilograms, and body mass index—Ridge regression will divide the predictive weight evenly among all three, assigning each a coefficient of roughly 0.33. Lasso, by contrast, will arbitrarily select one of the correlated variables to retain with a weight of 1.0, and drive the coefficients of the other two to zero.[3][7][8]
This arbitrary selection makes Lasso unstable for causal inference when multicollinearity is high. If a model drops a variable, it does not necessarily mean that variable has no real-world effect; it may simply mean another variable in the dataset captured the same information first. Consequently, in 2005, statisticians introduced Elastic Net, a hybrid approach that combines the L1 and L2 penalties to achieve both feature selection and stability among correlated predictors.[1][2][4][6]
The computational efficiency of a sparse model cannot be overstated in production environments. A model that requires 10,000 inputs to make a prediction consumes significantly more memory and processing power than a model that requires only 50. By driving coefficients to zero during the training phase, Lasso ensures that the final deployed model is lightweight and fast. Ridge regression generally provides better overall predictive accuracy when most variables have a small but genuine effect, but Lasso excels when the underlying reality is sparse.[3][4][5]
Chronology
1943
Tikhonov regularization is introduced to solve ill-posed mathematical problems.
1970
Hoerl and Kennard formally publish Ridge regression for linear models.
1996
Robert Tibshirani introduces the Lasso method to achieve both shrinkage and variable selection.
2005
Zou and Hastie introduce Elastic Net, combining L1 and L2 penalties to handle correlated variables.
Limits of the evidence
- Which of two highly correlated variables Lasso will drop, as the algorithm's choice is often arbitrary and dependent on minor data fluctuations.
- The exact threshold at which the L1 penalty becomes computationally less efficient than L2 in datasets with billions of parameters.
Sources
[1]Penn State UniversityPredictive Accuracy Advocates5.4 - The Lasso
Read on Penn State University →
[2]Columbia University Mailman School of Public HealthInterpretability AdvocatesLeast Absolute Shrinkage and Selection Operator (LASSO)
Read on Columbia University Mailman School of Public Health →
[3]Stanford UniversityInterpretability AdvocatesThe Elements of Statistical Learning: Data Mining, Inference, and Prediction (Second Edition)
Read on Stanford University →
[4]IBMHybrid PractitionersWhat is lasso regression?
Read on IBM →
[5]MetricGateL1 vs L2 Regularization: The Geometric Intuition Behind Each
Read on MetricGate →
[6]GeeksforGeeksHybrid PractitionersWhat is Lasso Regression
Read on GeeksforGeeks →
[7]R-bloggersPredictive Accuracy AdvocatesUnderstanding Lasso and Ridge Regression
Read on R-bloggers →
[8]GeeksforGeeksHybrid PractitionersRidge Regression vs Lasso Regression
Read on GeeksforGeeks →
[9]Factlen Editorial TeamSynthesis by Factlen editorial team
Read on Factlen Editorial Team →
Comments
More in Data & Analysis
See all →Chart Geometry
The Geometry of Deception: Why Bar Charts Require a Zero Baseline While Line Charts Do Not
7 sources
Evaluation Metrics
How the Quadratic Penalty in RMSE Forecast Evaluation Punishes Outliers Compared to MAE's Linear Loss
5 sources
Survey Methodology
Why Complex Survey Designs Lose Statistical Power: Inside the Design Effect Penalty
9 sources
Search Algorithms
BM25 vs. Dense Retrieval: The Accuracy and Latency Trade-offs in Search Ranking
2 sources
Every angle. Every day.
Get Data & Analysis stories with full source coverage and perspective breakdowns delivered to your inbox.




