KatInterview

Feature Selection Mechanism in L1-Regularized Regression

Machine LearningModel answer
MediumModel answerMachine Learningregularizationfeature-selectionlasso

Last updated

Explain how and why L1 regularization drives coefficients to exactly zero, covering mathematical foundations, practical implications, and trade-offs.

You're building linear regression models for high-dimensional datasets where interpretability and sparsity matter.

Explain how L1 regularization achieves automatic feature selection. Your answer should cover:

  1. The fundamental difference between L1 and L2 penalties in how they shrink coefficients
  2. A geometric view of why L1 constraints produce exact zeros
  3. The mathematical optimality condition that determines when a coefficient becomes zero
  4. How correlated features affect which variables get selected
  5. Why feature scaling is critical and what breaks without it
  6. The approach for tuning the regularization strength and its impact on model complexity
  7. Scenarios where combining L1 and L2 penalties is advantageous

Provide concrete mathematical intuition alongside practical considerations for model selection and stability.

Hints

Hint 1

Consider what happens to the gradient of |β| as the coefficient approaches zero compared to β²

Hint 2

Visualize the constraint region in 2D: which shape has corners on the axes?

Hint 3

Think about the subgradient at zero: when does the correlation between a feature and residuals justify including that feature?