EasyDeepLearn

L1 vs L2 regularization — what's the difference?

easy

Answer

  • L2 (ridge) adds sum(w2)\mathrm{sum}(w^{2}) to the loss and shrinks weights smoothly toward zero.
  • L1 (lasso) adds sum(w)\mathrm{sum}( \mid w \mid ) 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