difficulty 3/5
Lasso regression
Linear regression with a penalty on the sum of absolute coefficients — it drives weak coefficients to exactly zero, so fitting the model also selects the features.
Intuition
Ridge quietens useless features but keeps every one of them. With four hundred inputs that leaves you a model nobody can read.
Lasso removes them. By penalising the absolute size of coefficients rather than the square, it produces solutions where many coefficients are exactly zero — not small, zero. Fitting the model and choosing the features become the same operation.
Formal definition
How it works
Where it's used
Why & when
Worked example
Pitfalls
Check yourself
3 questions
The questions on this page come with access. They are graded on the server, so the answers stay there until you have given yours.
On the cheat sheet: Linear models →
Sources
- scikit-learn — sklearn.linear_model.Lassodocs · retrieved 2026-08-31https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html
- Deep Learning (2016)book · retrieved 2026-10-07https://www.deeplearningbook.org/contents/regularization.html
- scikit-learn user guide — Linear Modelsdocs · retrieved 2026-10-07https://scikit-learn.org/stable/modules/linear_model.html