EasyDeepLearn

L1 vs L2 in logistic regression — practical differences.

easy

Answer

  • Same intuition as in linear regression: L2 (default) shrinks all coefficients smoothly and stabilizes training under multicollinearity; L1 produces sparse coefficients and performs feature selection during training.
  • In scikit-learn, use penalty='l1' with the 'liblinear' or 'saga' solver.
  • L1 is nice for interpretable, sparse models on wide (many-feature) data; L2 is the default for prediction accuracy.
  • Elastic-Net penalty combines both.
Check yourself — multiple choice
  • L1 is faster than L2
  • L1 gives sparse coefficients (feature selection); L2 gives stable, smoothly shrunk coefficients
  • L1 requires a special metric
  • L2 gives sparse coefficients

L1 = sparsity. L2 = smooth shrinkage. Elastic-Net = both.

#logistic-regression#regularization

Practise Supervised Learning

215 interview questions in this topic.

Related questions