What is lasso regression?

Last updated 3 November 2026

Lasso (Least Absolute Shrinkage and Selection Operator) is linear regression with an L1 penalty on the coefficients, which both shrinks them and sets some exactly to zero, performing automatic feature selection.

  • Objective:

    • min_β (1/2n)‖y − Xβ‖² + λ‖β‖₁, where ‖β‖₁ = Σ|β_j|.

    • λ controls strength: λ = 0 is OLS; large λ drives all coefficients to zero.

  • Key property: sparsity: The non-differentiable kink of |β_j| at zero lets weak coefficients land exactly at 0, yielding simpler, interpretable models.

  • Fitting:

    • No closed form in general; solved by coordinate descent with soft thresholding (e.g. sklearn.linear_model.Lasso, glmnet) or LARS for the full path.

    • Choose λ by cross-validation (LassoCV).

  • Practical notes:

    • Standardize features first: the penalty is scale-dependent.

    • When p > n, it selects at most n features.

    • Unstable with correlated features (picks one arbitrarily) and biases large coefficients toward zero; elastic net or relaxed lasso help.

  • https://www.geeksforgeeks.org/machine-learning/what-is-lasso-regression/
  • https://www.scaler.com/topics/lasso-regression-in-machine-learning/
  • https://medium.com/@lomashbhuva/lasso-regression-l1-regularization-explained-with-practical-examples-a2560a784af2
All Regularization interview questions