L1 Versus L2

Sparse selection or shared shrinkage

L1 regularization adds the absolute values of coefficients. It can drive some weights exactly to zero, creating a sparse model that effectively selects features. L2 regularization adds squared coefficients. It smoothly shrinks weights toward zero and usually shares influence across correlated features rather than selecting only one.

before: [4.8, 1.7, 0.4, -3.2]
L1:     [3.1, 0.0, 0.0, -1.9]
L2:     [2.9, 1.1, 0.3, -2.0]
illustrative effect, not one universal result

Elastic net combines L1 and L2 penalties. It can preserve groups of correlated features better than pure L1 while still producing some zeros. Selection stability should be checked across folds; a feature chosen in one sample and discarded in another is not a reliable scientific discovery.

Scenario: Thousands of sparse word features feed a classifier. L1 can produce a compact subset useful for inspection; L2 may yield more stable predictive quality when many related words share signal.
Note: A zero coefficient means the fitted penalized model did not use that feature under this data and setting. It does not prove the feature is unrelated or causally irrelevant.