1
$\begingroup$

So I understand the general idea of how isolation forests works, but I'm having trouble understanding how the model makes predictions on new data.

Does it pass every new point (separately) through every tree in the trained model, and then runs the exact same splits with the exact same original subset data (plus this single new point), to determine the number of steps (anomaly score) until this new point gets isolated? Then this score gets compared back to the anomaly score threshold that was set when the model was trained?

$\endgroup$
1
  • $\begingroup$ What do you mean by original subset data? Only the trees are remembered from training $\endgroup$
    – Jon Nordby
    Commented Jun 24, 2018 at 11:45

2 Answers 2

1
$\begingroup$

You can find the sklearn implementation of Isolation Forest in Python at https://github.com/scikit-learn/scikit-learn/blob/a24c8b46/sklearn/ensemble/iforest.py#L229

It calculates the mean path depth needed to classify new samples. They are scored relatively to a theoretical average path length. Original training data is not used, only the learned trees.

$\endgroup$
0
$\begingroup$

Yes, it pass every new point (separately) through every tree in the trained model, and then runs the exact same splits with the exact same original subset data (plus this single new point), to determine the number of steps (anomaly score) until this new point gets isolated. Then it will average the path length computed from all the trees for that test instance and this would be the final anomaly score which is then normalized in the range 0-1.

$\endgroup$

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.