What is feature extraction in machine learning?
Feature extraction is the process of turning raw data into numeric features, the input columns a model learns from. It covers choosing which properties to measure, deriving new ones from existing columns, rescaling them, and compressing many features into a few. The goal is a table where the patterns that predict the target are easy for a model to find.
Every machine learning pipeline does some form of it. Tabular models for pricing, credit scoring, or churn rely on hand-built features such as ratios and time since the last event. Text models start from word counts, TF-IDF, or learned embeddings, and image models from pixel statistics or the activations of a pretrained network. In deep learning the network learns its own features, but the choice of inputs and their scaling still affects how well it trains.
Key ideas
- A feature is one measurable property of an example, stored as one column of the input table.
- Feature engineering creates new columns, such as ratios, bins, and log transforms, that expose patterns to the model.
- Scaling puts features on comparable ranges so distance- and gradient-based models are not dominated by large units.
- PCA builds a few new features that keep most of the variance of many correlated ones.
- Feature selection keeps the original columns that carry signal and drops redundant ones.
- Every statistic used to build features must be fit on training data only, or the evaluation leaks.
Common questions
What is the difference between feature extraction and feature selection?
Feature extraction creates new features, either by transforming raw data or by combining existing columns, as PCA does. Feature selection keeps a subset of the existing columns unchanged. Selection keeps features interpretable, while extraction can compress more information into fewer numbers.
Is feature extraction still needed with deep learning?
Less of it is done by hand. A CNN learns edge and texture detectors from raw pixels, and a language model learns its own word representations. Pretrained networks are now often used as feature extractors themselves. On tabular data, hand-built features and gradient-boosted trees remain hard to beat.
What are common examples of feature extraction?
For text, bag-of-words counts, TF-IDF weights, and embeddings. For images, color histograms, edge descriptors such as HOG, or activations from a pretrained CNN. For audio, mel-frequency cepstral coefficients (MFCCs), and for time series, lags, rolling averages, and calendar features such as day of week.
How many features should a model have?
There is no fixed number, but more features need more examples to estimate their effects reliably. When features outnumber examples, models overfit easily, and regularization or selection becomes necessary. Adding a feature is worth it when validation performance improves, not when training performance does.
Related explainers
- Feature Scaling — Why and how to normalize features for faster convergence
- Feature Selection — Filter, wrapper, and embedded methods for choosing features
- Dimensionality Reduction — PCA and t-SNE — seeing high-dimensional data
- Data Preprocessing — Cleaning, scaling, and encoding raw data
- Curse of Dimensionality — Why high-dimensional spaces break intuition and algorithms
- Transfer Learning — Standing on the shoulders of pretrained giants
References
- James, Witten, Hastie & Tibshirani, "An Introduction to Statistical Learning" (ISLR)
- Guyon & Elisseeff (2003), "An Introduction to Variable and Feature Selection", JMLR
- Goodfellow, Bengio & Courville, "Deep Learning", chapter 15: Representation Learning
Last updated