Feature and Permutation Importance

Shuffle one column, re-score the model, and see how much it mattered. Simple, model-agnostic, and easy to misread.

Feature and Permutation Importance

This module needs JavaScript: the numbers are computed in the page rather than recorded.

Worth knowing

Permutation importance breaks the link between one column and the target by shuffling it, then measures the damage.
It works on any fitted model, because it only needs predictions.
Measure it on held-out data. On training data it reports what the model memorised.
Correlated features hide each other: shuffle one and the model leans on its twin, so the measured drop is far below what that column is worth.

Overview

Permutation importance is the drop in a fitted model’s chosen score after one feature is shuffled. It describes reliance for that model, metric and dataset; it does not show that a feature causes the outcome.

In this guide
  1. Reading the chart
  2. Why: correlated features hide each other
  3. Held-out data, not training data
  4. Against a tree's built-in importance
  5. Repeats
  6. Where it goes wrong with Feature and Permutation Importance
  7. Experiments to try with Feature and Permutation Importance
  8. Runnable example
  9. Further reading

Reading the chart

The example compares a strong signal, a weak signal, noise and a duplicate copy of the strong signal. The model is a random forest.

noise scores about zero, which is correct and reassuring.

Now compare signal with copy of signal. They contain the same information, so shuffling either one leaves its twin available to the forest. Each can therefore receive a much smaller score drop than the signal provides as a group.

Why: correlated features hide each other

The method shuffles one column at a time. Some trees can use signal, while others use its copy. Shuffling only the copy leaves the original signal intact, so the score may barely change. Low importance here means the model can rely on the substitute; it does not mean the information is useless.

The metric is measured one column at a time, and with linked features that is the wrong unit of analysis. The honest reading isn't "the copy doesn't matter" but "either one largely substitutes for the other, and this method can't say that".

The effect depends on how the fitted model uses the features. With exact duplicates, a linear model may divide its coefficients between columns; a tree ensemble may use one as a substitute for the other. In either case, a single-column shuffle can understate the value of a correlated group.

This is the main limitation to check before interpreting the chart: the result can look plausible even when correlated features mask one another.

What to do about it:

Group related features and, where appropriate, permute the group together. This estimates the value of the group, not the unique contribution of each member.

Check the correlation matrix before reading any importance chart.

Conditional permutation methods can preserve dependencies between features, but require a suitable conditional model and a clearly defined question.

Held-out data, not training data

Importance measured on the training set can reward memorisation. A feature used to fit noise may appear valuable there even though it does not help on new data.

On held-out data, the method estimates how much that feature helps the chosen score generalise. Use data that was not used to fit the model, and choose a metric that reflects the task. The scikit-learn guide explains this evaluation procedure.

Comparing the two can be diagnostic: a feature that scores highly on training data but little on validation data may be associated with overfitting.

Against a tree's built-in importance

Random forests and boosted trees expose feature_importances_, often based on the mean decrease in impurity. It is available from the fitted model without an extra scoring pass, but can favour high-cardinality features because they offer more candidate split points. A random ID can therefore receive a misleadingly high score.

Permutation importance avoids that particular split-count bias, but costs a re-scoring pass per feature and can be used with models that have no built-in importance measure.

Repeats

Shuffling is random, so one result is noisy. Increase Shuffles per feature to estimate the average score drop and its variation across repeats. More repeats cost more scoring time; choose enough to see whether the ranking is stable for this dataset.

Where it goes wrong with Feature and Permutation Importance

Reading it on linked features. The central trap.

Measuring it on training data. The model may have memorised patterns that do not generalise.

Treating it as causal. It says the model used a feature, not that the feature causes the outcome.

Checking across models. Importance is scaled to one fitted model. A different model can rank the same features differently and both be right about themselves.

Experiments to try with Feature and Permutation Importance

  1. Set Shuffles per feature to 1, then raise it toward 12. Repeated shuffles average out some random variation, though they take longer.
  2. Change Shuffle seed. The bars can move because each run uses different permutations; large swings suggest the estimates are noisy.

Runnable example

The example measures importance on held-out data, compares a duplicated signal before and after removing its copy, and switches scoring metrics to show that importance depends on the question being measured.

example_01.pyscikit-learn
Output

Further reading

For implementation details, see the Permutation feature importance. Continue with partial dependence and SHAP to connect this topic to a related part of the workflow.

Check yourself

0 of 3

Answer without scrolling back up.

  1. Why shuffle a column rather than delete it?

  2. Two near-identical informative features both show low importance. Why?

  3. What bias does a tree's built-in impurity importance have?

Cheat sheet

Feature and Permutation Importance

Shuffle one feature at a time and measure the drop in accuracy. See why correlated features split the importance and how to handle it.

MACHINE LEARNING · vizlearn.in/machine_learning/permutation_importance.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.

Teaching a course with this? Individual teachers can use it freely; for a whole department or programme, see institutional licences.