Extended isolation forest

On this page 7

Extended isolation forest (EIF) is an unsupervised anomaly detection algorithm that isolates unusual points by splitting data with random hyperplanes of arbitrary orientation, rather than with the axis-parallel cuts of the original isolation forest. Introduced by Hariri, Carrasco Kind and Brunner, it keeps the core idea that anomalies are few and different and therefore easier to isolate, while removing a systematic bias in how the original method scores points.

The extension matters most when features are correlated or the normal data has curved or diagonal structure. In those cases the standard algorithm produces artificial bands of low scores along the coordinate axes, and EIF yields a score map that follows the actual shape of the data.

How extended isolation forest builds its trees

Like its predecessor, EIF builds an ensemble of isolation trees, each trained on a small random subsample of the data. At every internal node, instead of choosing one feature and one threshold, the algorithm draws a random normal vector and a random intercept point within the range of the data in that node. Points are sent left or right depending on which side of the resulting hyperplane they fall.

Splitting continues until a point is isolated or a maximum depth of about log2 of the subsample size is reached. Anomalies, sitting in sparse regions, tend to be separated after only a few splits, so their average path length across the forest is short. Normal points in dense regions need many splits and receive long paths.

The anomaly score is computed as two raised to the negative ratio of the mean path length to c(n), the expected path length of an unsuccessful search in a binary search tree of size n. Scores close to 1 indicate likely anomalies, while scores well below 0.5 indicate normal points.

Why axis-parallel splits create scoring artifacts

The original isolation forest can only cut parallel to the coordinate axes. For a single round cluster in two dimensions, the cuts accumulate in a cross-shaped pattern, so regions aligned with the cluster center along either axis receive lower anomaly scores than equally distant diagonal regions. A point that is clearly anomalous may look normal simply because it shares a coordinate value with dense data.

This axis-aligned bias becomes worse with multiple clusters, where ghost regions of low score appear at the intersections of their projections, and with sinusoidal or rotated structures, where axis cuts cannot follow the data. EIF removes the bias because random orientations treat all directions equally on average.

The table below contrasts the two algorithms on the properties that matter in practice.

PropertyIsolation forestExtended isolation forest
Split geometryOne feature, axis-parallel thresholdRandom hyperplane, any orientation
Score map shapeCross-shaped and banded artifactsFollows the data distribution
Correlated featuresBias toward axis directionsHandled without preprocessing
Cost per splitConstant in dimensionLinear in dimension
Interpretability of splitsReadable feature thresholdsHarder to explain directly
Standard and extended isolation forest compared

The extension level and other parameters

EIF introduces the extension level, which sets how many coordinates of the normal vector are allowed to be nonzero. In d dimensions the level ranges from 0 to d minus 1. Level 0 reproduces the standard isolation forest, and the maximum level gives fully oblique hyperplanes. Intermediate levels restrict splits to subspaces, which can help when only some features interact.

ParameterTypical valueWhat it controls
Number of trees100 to 300Stability of the averaged score
Subsample size256 pointsTree depth and sensitivity to clusters
Extension level0 to d minus 1, often fullFreedom of hyperplane orientation
Maximum depthAbout log2 of subsample sizeEarly stopping for normal points
Score thresholdSet from contamination rateCut-off for labeling anomalies
Main hyperparameters of extended isolation forest

As with the original method, small subsamples work well, because they reduce masking and swamping effects. The contamination rate or a validation set should determine the final threshold, since the raw score has no universally correct cut-off.

Choosing extended isolation forest among anomaly detectors

EIF is a strong default for tabular, numeric, unlabeled data of moderate dimension, where it offers near-linear training time and low memory use. It is not always the best choice, and the decision table below positions it against neighboring methods in anomaly detection.

SituationRecommended methodReason
Correlated numeric featuresExtended isolation forestOblique cuts avoid axis bias
Need for readable split rulesStandard isolation forestSingle-feature thresholds explain decisions
Local density differences matterLocal outlier factorCompares density with neighbors
Streaming data with driftRobust random cut forestSupports incremental updates
Images or raw signalsAutoencoder anomaly detectionLearns features from raw inputs
When to prefer extended isolation forest

Implementations are available in the eif reference package, the isotree library and in H2O, which makes EIF straightforward to adopt alongside existing tools such as PyOD.

Limitations and common mistakes

EIF inherits several weaknesses of tree-based isolation and adds a few of its own. The most important points to watch are listed below.

  • Unscaled features distort hyperplane orientation; standardize numeric columns before training.
  • Categorical variables need careful encoding, because one-hot columns create artificial geometry.
  • In very high dimensions random hyperplanes lose discriminative power, so feature selection still helps.
  • Oblique splits make anomaly explanation harder; attribution methods are needed for root-cause analysis.
  • Setting the threshold from an assumed contamination rate that is wrong leads to many false alarms.

Finally, a better score map does not guarantee better detection on every dataset. When anomalies differ from normal data mainly along single features, the standard and extended versions often perform similarly, and validation on labeled examples remains the only reliable comparison.

Put simply

Picture a crowd of points on a sheet of paper. Now cut the sheet again and again with random straight lines. A lonely point far from the crowd ends up alone after only a few cuts. A point inside the crowd needs many cuts. Fewer cuts mean more unusual.

The original method could only cut straight up or straight across. That made some odd points look normal by accident. The extended version cuts at any angle. Its judgment of what is unusual therefore matches the real shape of the data much better.

In practice

A reliability team monitors industrial pumps with temperature, vibration and pressure sensors. Vibration and temperature are strongly correlated during normal operation, so healthy readings form a diagonal band rather than a round cloud. A standard isolation forest flagged too few real faults and raised false alarms where the band met the axes.

The team switches to extended isolation forest at full extension level, with 200 trees, subsamples of 256 readings and standardized inputs. The threshold is set so that about 0.5 percent of hourly readings are flagged, matching historical fault rates.

On six months of labeled maintenance history, the new model catches more confirmed bearing faults and produces fewer false alerts in the corners of the operating range. Engineers pair each alert with a feature attribution report, so technicians know which sensor drove the score before they visit the pump.