Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Scramble one input and see what breaks
To find out how much a pilot relies on the altimeter, you could make it show random readings and watch how much worse the landing gets. Permutation importance does this to a trained model: shuffle one feature’s values across the test set, so they no longer match their rows, and measure how much the accuracy drops. A big drop means the model leans on that feature.
Permutation importance is the standard way to ask “which inputs does this model actually use?” for any model: a neural network, gradient boosting, or a vendor’s black box. It is the basis for many model reviews in safety-critical settings. It also shows why a model’s reliance on a sensor is not the same as that sensor causing the outcome.
- 1. Permutation importance shuffles…
- 2. A large score drop means the model…
- 3. Permutation importance works for…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.The algorithm by hand
Algorithm.
- Compute the model’s score s on a dataset, preferably held out.
- For feature j, shuffle column j (keep all other columns), and compute the score s₍ⱼ₎.
- The importance is s − s₍ⱼ₎. Repeat with several shuffles and report the mean ± standard error.
A tiny example. A linear classifier uses only feature 0: predict class 1 if x₀ > 0. The data are (−2, 5), (−1, −5), (1, 5), (2, −5) with classes 0, 0, 1, 1, so accuracy is 1.
- Reversing column 0 gives x₀ = (2, 1, −1, −2), and accuracy becomes 0: importance 1.
- Shuffling column 1 changes nothing: importance 0.
Uncertainty. Drops from four shuffles of 0.02, 0.04, 0.03 and 0.03 give 0.030 ± 0.004. A negative importance means shuffling did not hurt, so the feature is noise as far as the model is concerned.
Groups. To measure a set of features together, shuffle their columns with the same permutation. This keeps their joint distribution but breaks the link with y.
- 1. Importance is computed as…
- 2. A slightly negative permutation importance suggests…
- 3. To permute a group of features you…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.Held-out data and the biases it removes
Test set or training set? On training data, a model that memorised noise features is hurt when they are shuffled, so they appear important. On held-out data, memorised noise does not help, so its importance is near zero.
Exercise 1 (the mixed features of topic 149: linear, binary and |x| signals, an ID-like column, binary and continuous noise; fully grown forest of 30 trees; n = 400; 2 datasets; test accuracy 0.767).
| feature | MDI (training): share, rank | permutation on test: drop, rank | permutation on training: drop, rank |
|---|---|---|---|
| linear signal | 0.291, 1 | +0.168, 1 | +0.262, 1 |
| binary signal | 0.075, 6 | +0.063, 3 | +0.142, 2 |
| abs-value signal | 0.170, 2 | +0.068, 2 | +0.134, 3 |
| ID-like noise | 0.082, 3 | −0.001, 9 | +0.019, 7 |
| binary noise | 0.011, 10 | −0.004, 10 | +0.002, 10 |
| continuous noise (5) | 0.072–0.077 | −0.000 to +0.002 | +0.015 to +0.028 |
- Test-set permutation fixed MDI’s bias. The binary signal moved from 6th to 3rd, and every noise feature fell to about zero (at most +0.002).
- Training-set permutation still credited the noise (up to +0.028), because the deep trees had memorised it.
- Use held-out or out-of-bag data.
from sklearn.inspection import permutation_importance
r = permutation_importance(model, X_test, y_test, n_repeats=10, random_state=0) # r.importances_mean, r.importances_std- 1. On test data, noise features' permutation importance was about…
- 2. Training-set permutation importance credits…
- 3. The binary signal's rank by test-set permutation was…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory and pitfalls
Model reliance. Fisher, Rudin and Dominici (2019) define the model reliance of f on feature j as the ratio, or difference, of expected loss with xⱼ replaced by an independent copy, versus the original. Permutation importance estimates it. They also define model class reliance: the range of reliance across all well-performing models. A feature can be unimportant for one good model and crucial for another.
Correlated features.
- Substitution. If two features carry the same information, the model may use either one. Shuffling one leaves the other, so each looks less important than the information they share.
- Extrapolation. Shuffling one of two correlated features creates combinations never seen in training (a tall person weighing 40 kg), and the model’s behaviour there is arbitrary (Hooker, Mentch and Zhou, 2021).
Remedies:
- grouped permutation;
- conditional permutation (shuffle within groups of similar values of the correlated features; Strobl et al., 2008);
- drop-column importance (refit without the feature, which is expensive and measures a different thing).
Not causal. A proxy that the model uses gets importance, even if intervening on it would change nothing in the real system.
Interview questions.
- Why use held-out data? To measure reliance that generalises. On training data, overfitting inflates importance.
- Two features are correlated 0.99 and each has low permutation importance. What do you conclude? Nothing about either alone. Permute them as a group, and use domain knowledge to decide which to keep.
- 1. Model class reliance considers…
- 2. Shuffling one of two correlated features can create…
- 3. Permutation importance measures…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.How a proxy hides the true cause
History.
- L. Breiman (2001) introduced permutation importance for random forests.
- C. Strobl et al. (2008) introduced conditional variable importance.
- A. Fisher, C. Rudin and F. Dominici (2019) introduced model reliance and model class reliance.
- G. Hooker, L. Mentch and S. Zhou (2021) explained the extrapolation problem.
Exercise 2. The target depends on a cause z and a second signal. A proxy of z, correlated ρ with it, has no effect of its own. Forest of 25 trees with leaf size 5, n = 400, permutation importance on 1000 test points, 2 datasets.
| ρ | cause: drop | proxy: drop | both together | second signal | MDI share, cause and proxy | test accuracy |
|---|---|---|---|---|---|---|
| 0 | +0.245 | +0.001 | +0.249 | +0.126 | 0.479, 0.055 | 0.839 |
| 0.5 | +0.226 | +0.003 | +0.231 | +0.126 | 0.428, 0.081 | 0.829 |
| 0.9 | +0.183 | +0.038 | +0.240 | +0.136 | 0.360, 0.180 | 0.837 |
| 0.99 | +0.104 | +0.095 | +0.248 | +0.124 | 0.267, 0.271 | 0.834 |
- At ρ = 0.99, the true cause’s importance fell to less than half (0.245 to 0.104), and the proxy, which has no causal effect, scored almost as much. The forest used them interchangeably.
- The group importance stayed the same (about 0.24–0.25) at every ρ, so the information they carry together did not change, only how it was split.
- Accuracy did not change. Nothing in the model’s performance warns you that its importances are being shared.
- MDI showed the same split.
- Both measures describe the model’s reliance, and neither can say which of two near-identical features is the cause.
Permutation importance in AI, robotics and aerospace
- Model reviews: document which inputs a flight-control or health-monitoring model relies on, computed on held-out flights.
- Sensor-failure planning: permutation importance approximates the accuracy lost if a sensor’s signal became meaningless. Group redundant sensors to see their joint value.
- Caution: redundant sensor pairs hide each other’s importance, so never remove a sensor because its individual importance is low.
References
- L. Breiman (2001). “Random forests.” Machine Learning 45.
- C. Strobl, A.-L. Boulesteix, T. Kneib, T. Augustin, A. Zeileis (2008). “Conditional variable importance for random forests.” BMC Bioinformatics 9.
- A. Fisher, C. Rudin, F. Dominici (2019). “All models are wrong, but many are useful: learning a variable’s importance by studying an entire class of prediction models simultaneously.” JMLR 20.
- G. Hooker, L. Mentch, S. Zhou (2021). “Unrestricted permutation forces extrapolation: variable importance requires at least one more model, or there is no free variable importance.” Statistics and Computing 31.