In a logistic regression model with high-dimensional sparse features, which regularization technique tends to produce sparse model weights (setting unimportant features to zero)?
Select an answer to reveal the explanation.
Short Explanation and Infographic
L1 (Lasso) is the editor that cuts features entirely — its penalty creates corners in the optimization landscape where weights hit exactly zero. L2 (Ridge) just shrinks them close to zero but never kills them completely.
Full explanation below image
Full Explanation
L1 regularization adds λΣ|w_i| to the loss function. The L1 penalty's geometry (diamond shape in weight space) creates corners at the axes, where the optimal solution often lands exactly on a coordinate axis (w_i = 0). This produces exact sparsity — many coefficients become exactly zero, effectively removing those features from the model. Useful for: feature selection, high-dimensional text/NLP features, interpretability. L2 regularization adds λΣw_i² to the loss. The L2 penalty's geometry (circle/sphere) has no corners — the optimal solution shrinks all weights toward zero but rarely hits exactly zero. L2 is better for correlated features and produces more stable solutions. Elastic Net combines both: elasticNetParam=0.0 is L2 (Ridge), elasticNetParam=1.0 is L1 (Lasso), intermediate values mix both. In Spark MLlib LogisticRegression: regParam controls regularization strength, elasticNetParam controls L1/L2 mix.