More features feel like more information, and more information feels like a better model. It isn't so. Past a point, extra features make models worse: they add noise, invite overfitting, cost compute and money to collect, and turn an interpretable model into an inscrutable one. The discipline of choosing a small, potent subset is feature selection, and this page builds up to its sharpest single tool — mutual information, a measure of dependence that sees relationships a correlation coefficient is blind to.
Four forces push toward a lean feature set:
Selection methods differ in how tightly they couple to the model you'll eventually train:
| Family | How it works | Trade-off |
|---|---|---|
| Filter | Score each feature against the target with a cheap statistic (correlation, χ², mutual information) and keep the top ones — model-agnostic | Fast and scalable, but judges features one at a time, so it misses features useful only in combination |
| Wrapper | Search over feature subsets, actually training the model on each (forward selection, backward elimination, recursive feature elimination) | Catches interactions and tailors to the model, but expensive — many model fits |
| Embedded | Selection happens inside training: L1/Lasso drives weak coefficients to exactly zero; trees expose feature importances | Efficient and model-aware, but tied to that particular model family |
The embedded star is L1 (Lasso) regularisation: adding a penalty proportional to the
sum of absolute weights
The best filter score for general use is mutual information. Built from
Its superpower is that it captures any statistical dependence, not just a straight-line
one. Pearson correlation measures only linear association: a feature and target related by
Two catches. First, estimating mutual information from a finite sample — especially for continuous features — is fiddly: it needs binning or a nearest-neighbour estimator, and the estimate is noisy with little data. Second, like every filter it scores features one at a time against the target, so it can keep two highly redundant features that each look great alone but add nothing together, and it can drop a feature that is useless alone yet decisive in combination (the classic XOR pattern). "Maximum relevance, minimum redundancy" (mRMR) methods extend mutual information to fight the first problem; wrapper and embedded methods handle the second.
The most common way to fool yourself with feature selection is to run it on the whole dataset
first — picking the features that correlate best with the target across every row — and only
then split into folds to evaluate. But the selection has already peeked at the test rows'
targets, so the reported score is optimistic, sometimes wildly so. This is
Kaggle Learn's Feature
Engineering course has a whole lesson on mutual information, where you compute MI scores
with scikit-learn to rank features on a real housing dataset before you engineer new
ones. It's the fastest way to make this measure concrete.