What is feature selection in machine learning?
Feature selection is the process of choosing a subset of the input variables in a dataset and discarding the rest before or during model training. Unlike dimensionality reduction methods such as PCA, it keeps the original columns, so the model still works with named, interpretable inputs. The three main families are filter methods, wrapper methods, and embedded methods.
It is used wherever there are many candidate inputs and limited data: genomics studies with thousands of genes per patient, credit models built from hundreds of account variables, and sensor or log data with many redundant signals. Removing irrelevant columns reduces overfitting, speeds up training and inference, cuts the cost of collecting data in production, and makes a model easier to explain to users and regulators.
Key ideas
- Feature selection keeps a subset of the original inputs and drops the rest.
- Irrelevant features raise training accuracy but lower test accuracy.
- Filter methods score features one at a time and miss interactions.
- Wrapper methods such as forward selection search subsets by retraining the model.
- Embedded methods such as the lasso and tree importance select features during training.
- Selection must run inside cross-validation, or the performance estimate is biased upward.
Common questions
What is the difference between feature selection and dimensionality reduction?
Feature selection keeps some of the original columns unchanged. Dimensionality reduction, such as PCA or an autoencoder, builds new features as combinations of all the original ones. Selection keeps the model interpretable and can remove columns from data collection entirely, while reduction can capture signal spread across many weak features.
How many features should I keep?
Treat the number as a hyperparameter and choose it with cross-validation, scoring each candidate count on held-out folds. A common practical rule is to pick the smallest set whose score is within one standard error of the best. Domain constraints, such as the cost of collecting each feature, can justify a smaller set.
How should correlated features be handled?
Two highly correlated features carry mostly the same information, so selection methods may keep either one, and the choice can flip between runs. The lasso tends to pick one arbitrarily, while the elastic net, which mixes L1 and L2 penalties, keeps correlated groups together. Tree importance splits credit between them, so each can look less important than it is.
Is feature selection needed for deep learning?
Less often on raw data such as images, audio, and text, because networks learn their own representations and are trained on large datasets. It still helps on tabular data with many noisy columns, where removing junk inputs can improve accuracy and cut serving costs. Regularization and dropout handle part of the same job inside the network.
Related explainers
- Curse of Dimensionality — Why high-dimensional spaces break intuition and algorithms
- Regularization — Dropout, L1, and L2 — keeping models honest
- Dimensionality Reduction — PCA and t-SNE — seeing high-dimensional data
- Decision Trees & Splitting — Recursive partitioning, Gini impurity, and pruning
- Feature Extraction — How networks find patterns in raw data
- Cross-Validation — K-fold, stratified, and leave-one-out evaluation
References
- Guyon & Elisseeff (2003), "An Introduction to Variable and Feature Selection", JMLR
- Tibshirani (1996), "Regression Shrinkage and Selection via the Lasso", JRSS-B
- Breiman (2001), "Random Forests", Machine Learning
- Ambroise & McLachlan (2002), "Selection bias in gene extraction on the basis of microarray gene-expression data", PNAS
Last updated