179 questions
No questions match those filters.
Why does L1 regularization drive coefficients to exactl...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansBoth add a penalty to the loss, but the shape of the penalty’s constraint region decides whether coefficients land on an axis (zero) or just shrink. Picture the unconstrained least-squares solution as a point surrounded by elliptical contours of equal loss, and the regularization constraint as a fixed-size region around the origin: L2’s constraint is a sphere, L1’s is a diamond in 2D (a cross-polytope in higher dimensions).
As the loss ellipse shrinks until it first touches the constraint region, a sphere is smooth everywhere, so the tangent point generically has every coordinate nonzero. A diamond has corners sitting exactly on the axes, and those corners are disproportionately likely to be where the ellipse first touches, because they’re the extremal points of a non-smooth boundary. That’s why Lasso (L1) performs implicit feature selection and produces sparse solutions, while Ridge (L2) redistributes weight across correlated features and keeps everything small but nonzero. Practically: reach for L1 when you suspect most features are irrelevant and want an interpretable, sparse model; reach for L2 when features are collinear and you want stability without discarding information; Elastic Net blends both when you want sparsity without Lasso’s instability under correlated predictors.