I knew this cold on paper but fumbled the 'when would you prefer one over the other' part.
Start by defining overfitting and its symptoms, then explain why it harms generalization. Next, describe L1 and L2 regularization mathematically and intuitively, contrasting their effects on weights. Finally, discuss practical selection criteria based on feature sparsity, interpretability, and computational considerations.
Pro tip: Mention that L1 regularization can be solved efficiently using proximal gradient methods, and that in practice, elastic net (a combination of L1 and L2) often outperforms either alone when features are correlated.
Explain overfitting as when a model learns noise in training data, leading to poor generalization. Mention symptoms like high training accuracy but low validation accuracy.
Describe regularization as adding a penalty term to the loss function to constrain model complexity, thus reducing overfitting.
Detail the L1 penalty (sum of absolute weights) added to loss. Explain its effect: drives some weights exactly to zero, producing sparse models and feature selection.
Detail the L2 penalty (sum of squared weights) added to loss. Explain its effect: shrinks weights towards zero but not exactly zero, reducing variance and handling multicollinearity.
Discuss when to use each: L1 for feature selection and interpretability; L2 for stability and when all features are relevant. Mention elastic net as a hybrid.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.