Every classifier so far needed labeled examples of what "wrong" looks like. What finds the one weird point in a dataset when nobody has ever labeled anything as an outlier at all?
Six points: five clustered close together, one sitting far off on its own. No labels, no training signal about which one is "the anomaly" — just an anomaly score for each point, computed from nothing but how the data happens to be spread out.
An isolation tree repeatedly splits a dataset, at each step separating it into two groups, until every point sits alone. The score is just how many splits that took:
- — the anomaly score assigned to point .
- — a single data point being scored.
- — how many splits an isolation tree needs before ends up alone.
- Outliers isolate almost immediately
A point sitting off on its own tends to land alone after just one or two splits — there's nothing else nearby to keep splitting away from it.
- Clustered points need many more splits
A point buried in a dense cluster needs several splits before every one of its close neighbors has been separated out too.
The outlier isolates in a single split. Every clustered point needs three or four. That gap is the entire signal isolation forests use — no notion of "normal," no boundary to fit, just: how fast does a random cut leave this point by itself?
Points , split at the midpoint of whatever range remains each time:
- The very first split isolates the outlier
Range splits at its midpoint, . Everything below goes one way, goes the other, alone — isolated after exactly split.
- The cluster needs several more splits
- splits at , giving and
- Splitting again at isolates both and , at depth
- Splitting at isolates , also at depth
- The last two take one split further
needs one more split, at , before and are each isolated — at depth , the deepest of any point in this dataset.
Click the point that isolates in the fewest splits — the anomaly.
A real isolation forest builds many trees, each picking a random feature and a random split point rather than always cutting at the midpoint, then averages the isolation depth across all of them — smoothing out the luck of any one particular tree. But the core mechanism is exactly what showed up here: points that are rare and different tend to fall away from the rest of the data almost immediately, and that's a signal worth measuring even when nobody has ever told the model what "anomalous" means.