L1 vs L2 regularization — what's the difference?
easyAnswer
- L2 (ridge) adds to the loss and shrinks weights smoothly toward zero.
- L1 (lasso) adds and pushes weights exactly to zero, giving sparse solutions and doing feature selection.
- Elastic Net combines both.
- Use L1 when you want a sparse, interpretable model; use L2 when you want smooth shrinkage and stable coefficients.
Check yourself — multiple choice
- L1 shrinks smoothly, L2 sets weights to zero
- L1 produces sparse solutions, L2 shrinks smoothly
- L1 and L2 are equivalent
- L2 is only for classification
L1 = sparsity/feature selection. L2 = smooth shrinkage.
#regularization#linear-models
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- Why does Ridge regression give more stable coefficients than OLS?
- Why does L1 (Lasso) produce sparse coefficients but L2 (Ridge) does not?
- When is Elastic Net better than pure Lasso or Ridge?
- How do you choose the regularization strength (lambda / alpha)?
- In one sentence, what does the LARS algorithm compute?
- What's the Bayesian interpretation of Ridge regression?