EasyDeepLearn

How is feature importance computed from a decision tree or random forest?

medium

Answer

  • Impurity-based (MDI): sum, over all splits using that feature, of the impurity decrease weighted by the number of samples reaching the split.
  • Cheap and comes free from training.
  • Problem: biased toward high-cardinality and continuous features.
  • Permutation importance: shuffle a feature's values on a held-out set and measure the drop in metric — unbiased, model-agnostic, more expensive.
  • SHAP values: consistent, additive, per-example — the gold standard when you can afford them.
Check yourself — multiple choice
  • Only from R2R^{2}
  • Impurity-based (MDI, cheap but biased) or permutation / SHAP (better but slower)
  • Only from cross-validation
  • By counting features used at leaves

MDI (impurity) is cheap; permutation / SHAP are more reliable.

#decision-trees#trees#interpretability#feature-selection

Practise Supervised Learning

215 interview questions in this topic.

Related questions