How is permutation feature importance calculated using out-of-bag samples?

Last updated 5 November 2026

  • For each tree, measure error on its OOB rows, permute feature j within those rows, and re-measure. Importance is the mean error increase across trees (optionally divided by its standard deviation).

  • Using OOB rows reflects predictive value on unseen data without a separate validation set. R reports it as Mean Decrease Accuracy, while scikit-learn's permutation_importance uses a held-out set instead.

  • Correlated features create unrealistic shuffled rows and mask each other, and results are noisy, so use several repeats.

  • https://medium.com/codetodeploy/permutation-importance-as-a-performance-based-measure-of-feature-contribution-c5da64e1f16e
  • https://medium.com/data-science-explained/permutation-feature-importance-explained-76d1398b1c6f
  • https://tryml.vercel.app/topics/random-forest
All Random Forests interview questions