3
$\begingroup$

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!

$\endgroup$
  • 1
    $\begingroup$ Did you get an answer yet? $\endgroup$ – user2684128 Sep 27 '18 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$ – Terence Parr Jan 4 at 22:17
  • $\begingroup$ @TerenceParr My thinking behind #2 is similar to the idea of permutation importance used for supervised learning algorithms. $\endgroup$ – Jana Dodson Jan 6 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$ – Terence Parr Jan 7 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.