AI Glossary / AI and machine learning / Intermediate
L1-based feature selection
Definition
L1-based feature selection uses a model penalized by the sum of absolute coefficient values to identify a smaller set of input features. The penalty can drive some coefficients exactly to zero, allowing the corresponding features to be excluded from a prediction pipeline.
What it means
A dataset can contain many candidate measurements, some redundant or weakly useful for the chosen task. An L1-regularized model balances fitting the target with keeping the total absolute coefficient magnitude small.
Unlike ordinary L2 shrinkage, L1 regularization often produces a sparse coefficient vector: several features receive exactly zero weight. A selector can retain features whose coefficient magnitudes exceed a chosen threshold and pass those features to the same or another model.
The selected set is specific to the training data, model family, preprocessing and penalty strength. A zero coefficient does not prove a feature has no relationship with the outcome, and a nonzero coefficient does not prove a causal effect.
How it works
Choose an L1-capable estimator suited to the task, such as Lasso for regression or an appropriately configured linear classifier. Fit preprocessing, including scaling where appropriate, using training data only.
Fit the model with a selected regularization strength. Stronger L1 pressure generally encourages more sparsity, although exact selection behavior depends on the data and optimization. Convert the fitted coefficients into a feature mask using a documented numerical threshold.
If another estimator follows the selector, train it only on the retained columns. Keep the entire selection-and-prediction pipeline inside cross-validation so that validation labels cannot influence which features survive.
With correlated predictors, one feature may stand in for another, and small data changes can change the selected set. Inspect selection stability across appropriate resamples rather than treating one sparse solution as a definitive inventory of useful information.
Three practical examples
- A text classifier uses an L1-penalized linear model to retain a smaller subset of word features.
- A regression experiment compares all measurements with a pipeline that first selects features using Lasso.
- An analyst repeats selection across training folds to see whether highly correlated variables exchange places in the retained set.
Think of it this way
Think of packing a toolkit while paying a charge for every item's contribution to the load. Items must justify their inclusion through the work they help perform, so some are left out.
The analogy illustrates a tradeoff, but L1 penalizes coefficient magnitude rather than literally charging one fixed fee per feature. Its mathematical shape creates sparsity, and the chosen set depends on how features are scaled and on the task being fitted.
Worked example
Consider a deliberately simplified orthogonal-feature problem with objective one half of the sum of squared differences between coefficients beta and values z, plus lambda times the sum of absolute beta values.
Let z = (2.0, 0.3, −1.2, 0.05) and lambda = 0.5. Each coefficient is obtained by soft-thresholding: reduce its magnitude by 0.5, stopping at zero, while preserving its sign.
The solution is beta = (1.5, 0, −0.7, 0). Features 1 and 3 remain; features 2 and 4 are removed if selection uses nonzero coefficients.
With lambda = 1.5, the solution becomes (0.5, 0, 0, 0), leaving only feature 1. This illustrates how penalty strength affects sparsity. It is not a formula for independently thresholding ordinary coefficients in every dataset: correlated designs require solving the coupled optimization problem, and software objectives can use different scaling conventions.
Illustrative case study
The fictional MapleSignals team has several overlapping measurements from a production process. An L1 selector keeps one of two closely related temperature features, leading an initial report to call the discarded measurement useless.
The team repeats the analysis across validation folds and finds that the retained member of the pair changes. It revises the interpretation: the sparse model can use either measurement as a similar predictor in this dataset.
It then evaluates the reduced pipeline on held-out observations and considers measurement availability and maintenance cost. This invented case illustrates selection stability and interpretation. It reports no real predictive gain or operational saving.
Common misconceptions and mistakes
- Zero coefficient means no possible predictive value. The feature may be redundant, useful through nonlinear effects, or suppressed by the chosen penalty.
- L1 selection is unaffected by units. Changing feature scale changes the relationship between coefficient magnitude and penalty.
- Selecting once on the full dataset before cross-validation is harmless. That can leak validation-label information into the feature set.
Business use
L1-based selection can reduce the number of measurements a model uses and make a linear predictor easier to inspect. It can also serve as a screening step before another estimator.
Evaluate the complete reduced pipeline against an appropriate baseline, including any data-collection costs that motivate selection. Fit the selector within the training folds and reserve a final test set. Document regularization and threshold settings. Check stability when predictors are correlated and avoid causal language about selected coefficients. If important effects are nonlinear or interaction-based, a sparse linear selector may remove features a different model could use.
People also ask
Is L1 feature selection limited to regression?
No. L1-penalized classification models can also provide sparse coefficients.
Does increasing the penalty always retain a useful feature set?
No. Excessive regularization can remove too much information, including all features under some settings.
Must the final predictor be the L1 model?
No. A selector can pass retained columns to another estimator, but the combined pipeline needs validation.
Check your understanding
An L1 model retains one of two nearly identical predictors. Does this establish that the selected predictor causes the outcome and the other does not?
Answer: No. The result reflects a predictive optimization with correlated inputs, not a causal identification procedure.
Related terms
- Lasso
- Sparsity
- Regularization
- Feature Selection
- Elastic-Net
- Cross-validation
- coefficient
- feature scaling
Learn next
Read Lasso and elastic net. Compare their behavior when two features are strongly correlated, then outline a validation pipeline that fits scaling and selection without using validation labels.
More in AI and machine learning
- Kolmogorov - Arnold Networks - Kolmogorov - Arnold networks, usually called KANs, are neural-network architectures that learn univariate functions on connections between nodes.
- L 1 regularization - L1 regularization is a penalty added to training that charges the model for the size of its weights, with the distinctive effect of pushing unneeded weights...
- L 2 regularization - L2 regularization is a penalty added to training that charges the model for the square of its weights, shrinking all weights toward zero to keep any single...
- Label - A label is the known answer attached to an example: the category, number or outcome the model is supposed to learn to predict, such as spam, churned or 42000.
- Label leakage - Label leakage is the accidental inclusion, in a model's inputs, of information that is derived from or equivalent to the answer, so the model learns to read...
- Label noise - Label noise is error or unreliability in the target labels used to train or evaluate a supervised learning system.
Sources
Scikit-learn, L1-based feature selection: https://scikit-learn.org/stable/modules/feature_selection.html#l1-based-feature-selection
Scikit-learn, Lasso and sparse linear models: https://scikit-learn.org/stable/modules/linear_model.html#lasso
The official feature-selection mechanism and L1 model context were reviewed. The orthogonal soft-thresholding calculation and fictional correlated-feature case are original, with objective scaling and interpretation limits stated explicitly.
Previous: L 2 regularization Next: L1-norm principal component analysis