Isolation Forest — how does it detect anomalies?
mediumAnswer
- Build many random trees splitting on random features and thresholds.
- Anomalies are 'isolated' with fewer splits than inliers (shorter path length).
- Score s(x, n) = 2^(-E[h(x)] / c(n)) where E[h] = average path length, c(n) = normalization.
- Fast O(n log n), works well in high dims, no density estimation.
- Standard first choice for tabular anomaly detection.
Check yourself — multiple choice
- Random
- Random trees; anomalies isolated with shorter paths; score = 2^(-E[h]/c(n)); fast O(n log n) high-dim tabular default
- Same as k-means
- Not real
Isolation Forest: shorter random-tree paths for anomalies; standard tabular AD.
#anomaly-detection
Practise Unsupervised Learning
214 interview questions in this topic.