As of scikit-learn version 0.19.1, there is no implementation for calculating feature importance in an Isolation Forest. I'm also having trouble finding any online resources proposing ways to get at the problem. Does anyone know of any established methods for doing this or have any suggestions?

Here are some ideas I've been thinking about:

  1. Calculate some kind of 'isolation metric' for each node in each tree (such as % of samples split) and get an average of this metric for each splitting feature.
  2. After the model has been fit, go through each feature one at a time, randomly permute the data for that feature, and calculate the anomaly scores. Then calculate the average change in the anomaly scores.

All insights welcome. Thanks!

  • 1
    $\begingroup$ Did you get an answer yet? $\endgroup$ Sep 27, 2018 at 13:21
  • $\begingroup$ Just tried your #1 as it was my first guess too. Gives weird results. A random column appears to be "important". Permuting data likely won't do much for #2 as it randomly picks value between min/max for each split. Permutation won't affect min/max. Maybe we should look at kurtosis of scores after dropping each col in turn? I'll try that. $\endgroup$ Jan 4, 2019 at 22:17
  • $\begingroup$ @TerenceParr My thinking behind #2 is similar to the idea of permutation importance used for supervised learning algorithms. $\endgroup$ Jan 6, 2019 at 23:20
  • $\begingroup$ @JanaDodson An excellent idea! I am thinking same direction but we need a measure of quality of anomaly detection (unsupervised) in order compute drop in quality when we mess up a feature. BTW, i tried using kurtosis on anomaly scores and path length but got gibberish for feature importances :( $\endgroup$ Jan 7, 2019 at 20:05
  • $\begingroup$ It seems that it has been answered here : stats.stackexchange.com/questions/404017/… $\endgroup$ Oct 18, 2020 at 14:50

1 Answer 1


Interpretable Anomaly Detection with DIFFI: Depth-based Isolation Forest Feature Importance

enter image description here

The Isolation Forest is one of the most commonly adopted algorithms in the field of Anomaly Detection, due to its proven effectiveness and low computational complexity. A major problem affecting Isolation Forest is represented by the lack of interpretability, an effect of the inherent randomness governing the splits performed by the Isolation Trees, the building blocks of the Isolation Forest. In this paper, they proposed effective, yet computationally inexpensive, methods to define feature importance scores at both global and local levels for the Isolation Forest. Moreover, they defined a procedure to perform unsupervised feature selection for Anomaly Detection problems based on the interpretability method; such a procedure also serves the purpose of tackling the challenging task of feature importance evaluation in unsupervised anomaly detection. Performance on several synthetic and real-world datasets, including comparisons against state-of-the-art interpretability techniques were added to the paper.

  title={Interpretable anomaly detection with diffi: Depth-based feature importance for the isolation forest},
  author={Carletti, Mattia and Terzi, Matteo and Susto, Gian Antonio},
  journal={arXiv preprint arXiv:2007.11117},

Code for the paper "Interpretable Anomaly Detection with DIFFI: Depth-based Isolation Forest Feature Importance".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.