A random forest has features x1 (a truly informative binary variable) and x2 (a continuous pure-noise variable). Why can mean decrease in impurity (MDI) rate x2 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

  1. MDI: for each feature, add up (weighted by node size) the impurity decrease of every split on it, and average over trees.
  2. 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 x2 collects a lot of importance.
  3. Permutation importance: for each tree, compute the OOB accuracy, then randomly shuffle xj among the OOB samples and recompute. The importance is the average drop, e.g. 0.90→0.78 gives 0.12.
  4. For pure noise, shuffling changes nothing on unseen data, so its importance is about 0. For an informative x1 the accuracy falls clearly.
  5. Weakness: if x1 and x3 are strongly correlated, shuffling one leaves the other to carry the information, so both look unimportant. Shuffling also creates unrealistic combinations of feature values.
  6. Remedies: permute correlated groups together, use conditional permutation, or drop a feature and retrain.

Common mistakes

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 w∗=−G/(H+λ) and the split gain derived in XGBoost's second-order objective? How do you apply it to 6 samples with logistic loss, current prediction F=0 (so p=0.5), labels 1,1,0 in the left candidate leaf and 1,0,0 in the right, λ=1, γ=0.1?
Next in Supervised learning: For a hard-margin SVM trained on n linearly separable points, how do you prove that the leave-one-out error is at most NSV/n, where NSV is the number of support vectors, and what does this imply about the expected test error?