Skip to main content
ExplainerRegularization MethodsAlgorithm Mechanics· 3 min read· in Data & Analysis

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 35%Interpretability Advocates 35%Hybrid Practitioners 30%
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]

The sharp corners of the L1 penalty's diamond constraint force the optimal solution to intersect an axis, driving one coefficient to exactly zero.

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]

As the penalty increases, Ridge regression shrinks all coefficients toward zero, while Lasso forces them exactly to zero one by one.

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]

Key differences in how L1 and L2 penalties handle high-dimensional data.

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]

1996
Year Lasso was introduced
1970
Year Ridge was formalized
2005
Year Elastic Net was introduced

Chronology

  1. 1943

    Tikhonov regularization is introduced to solve ill-posed mathematical problems.

  2. 1970

    Hoerl and Kennard formally publish Ridge regression for linear models.

  3. 1996

    Robert Tibshirani introduces the Lasso method to achieve both shrinkage and variable selection.

  4. 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

Source coverage

9 outlets

3 viewpoints surfaced

Predictive Accuracy Advocates 35%Interpretability Advocates 35%Hybrid Practitioners 30%
  1. [1]Penn State UniversityPredictive Accuracy Advocates

    5.4 - The Lasso

    Read on Penn State University
  2. [2]Columbia University Mailman School of Public HealthInterpretability Advocates

    Least Absolute Shrinkage and Selection Operator (LASSO)

    Read on Columbia University Mailman School of Public Health
  3. [3]Stanford UniversityInterpretability Advocates

    The Elements of Statistical Learning: Data Mining, Inference, and Prediction (Second Edition)

    Read on Stanford University
  4. [4]IBMHybrid Practitioners

    What is lasso regression?

    Read on IBM
  5. [5]MetricGate

    L1 vs L2 Regularization: The Geometric Intuition Behind Each

    Read on MetricGate
  6. [6]GeeksforGeeksHybrid Practitioners

    What is Lasso Regression

    Read on GeeksforGeeks
  7. [7]R-bloggersPredictive Accuracy Advocates

    Understanding Lasso and Ridge Regression

    Read on R-bloggers
  8. [8]GeeksforGeeksHybrid Practitioners

    Ridge Regression vs Lasso Regression

    Read on GeeksforGeeks
  9. [9]Factlen Editorial Team

    Synthesis by Factlen editorial team

    Read on Factlen Editorial Team

Comments

Stay informed

Every angle. Every day.

Get Data & Analysis stories with full source coverage and perspective breakdowns delivered to your inbox.