A random forest has features (a truly informative binary variable) and (a continuous pure-noise variable). Why can mean decrease in impurity (MDI) rate as important, and how does permutation importance on the out-of-bag (OOB) data fix this? What is its own weakness with correlated features?
Supervised learning, Random forest feature importance
Level L4 Advanced. Length Medium. Nature Th Theoretical.
What's being asked
Whether you understand the bias of impurity-based importance and the logic of permutation importance.
Key idea
MDI sums impurity decreases measured on the training (in-bag) data, so a feature with many possible split points can win by chance. Permutation importance measures the drop in held-out (OOB) accuracy when a feature is shuffled, which noise cannot fake.
Steps
- MDI: for each feature, add up (weighted by node size) the impurity decrease of every split on it, and average over trees.
- A noise feature with many distinct values offers many thresholds. Among them, one will reduce the training impurity by luck, whereas a binary feature has just one split. Deep trees keep splitting on the noise until the leaves are pure, so collects a lot of importance.
- Permutation importance: for each tree, compute the OOB accuracy, then randomly shuffle among the OOB samples and recompute. The importance is the average drop, e.g. gives .
- For pure noise, shuffling changes nothing on unseen data, so its importance is about 0. For an informative the accuracy falls clearly.
- Weakness: if and are strongly correlated, shuffling one leaves the other to carry the information, so both look unimportant. Shuffling also creates unrealistic combinations of feature values.
- Remedies: permute correlated groups together, use conditional permutation, or drop a feature and retrain.
Common mistakes
- Believing MDI is wrong everywhere. It is cheap and fine for low-cardinality features.
- Computing permutation importance on the training set, where an overfit forest uses noise features.
- Reading importance as a causal effect.
How long your answer should be
A paragraph or two; 4 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: How is the optimal leaf weight and the split gain derived in XGBoost's second-order objective? How do you apply it to 6 samples with logistic loss, current prediction (so ), labels in the left candidate leaf and in the right, , ?
Next in Supervised learning: For a hard-margin SVM trained on linearly separable points, how do you prove that the leave-one-out error is at most , where is the number of support vectors, and what does this imply about the expected test error?