How does L1 regularization act as an embedded feature selection method?

Quick Overview

Explain how L1 (lasso) regularization drives coefficients to exactly zero and so selects features while the model trains. Tests the geometric and soft-thresholding views of sparsity, how the penalty strength is tuned, and practical caveats such as feature scaling and correlated inputs.

How does L1 regularization act as an embedded feature selection method?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does L1 regularization act as an embedded feature selection method? Explain why the L1 penalty removes features during training, what "embedded" means compared with other feature selection approaches, and what you need to watch for when you use it in practice. ```hint Shape of the penalty Compare the constraint regions of the L1 and L2 penalties, or compare how each penalty's slope behaves as a weight approaches zero. ``` ```hint Where selection happens Think about how many model fits a wrapper method needs and what a filter method ignores about the other features. ``` ### What a Strong Answer Covers - Why the L1 penalty yields coefficients that are exactly zero (geometric or soft-thresholding view) and how this differs from L2 - What makes the method "embedded" compared with filter and wrapper methods - How the regularization strength sets the number of surviving features and how it is tuned - Practical caveats: feature scaling and behavior with correlated features - How the selected features are extracted and used in a modeling pipeline ### Follow-up Questions - How would you check whether the set of features L1 selects is stable across resamples of the data? - Your data has a categorical variable one-hot encoded into 40 columns. How would you make the penalty keep or drop the variable as a whole? - Should you refit an unpenalized model on the selected features, and what does that change? - How would you get embedded feature selection for a gradient-boosted tree model or a neural network?

Overview: Explain how L1 (lasso) regularization drives coefficients to exactly zero and so selects features while the model trains. Tests the geometric and soft-thresholding views of sparsity, how the penalty strength is tuned, and practical caveats such as feature scaling and correlated inputs.

PracHub logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does L1 regularization act as an embedded feature selection method?

Explain why the L1 penalty removes features during training, what "embedded" means compared with other feature selection approaches, and what you need to watch for when you use it in practice.

What a Strong Answer Covers Guidance

  • Why the L1 penalty yields coefficients that are exactly zero (geometric or soft-thresholding view) and how this differs from L2
  • What makes the method "embedded" compared with filter and wrapper methods
  • How the regularization strength sets the number of surviving features and how it is tuned
  • Practical caveats: feature scaling and behavior with correlated features
  • How the selected features are extracted and used in a modeling pipeline

Follow-up Questions Guidance

  • How would you check whether the set of features L1 selects is stable across resamples of the data?
  • Your data has a categorical variable one-hot encoded into 40 columns. How would you make the penalty keep or drop the variable as a whole?
  • Should you refit an unpenalized model on the selected features, and what does that change?
  • How would you get embedded feature selection for a gradient-boosted tree model or a neural network?