Skip to content
Back to search results

Isolation Forest

Introduced by
Liu, F.T., Ting, K.M. & Zhou, Z.-H.
Year
2008
Type
Unsupervised ensemble (random partitioning trees)
Font size

What does it do?

Isolation Forest is an unsupervised machine-learning method for anomaly and outlier detection, introduced by Liu, Ting and Zhou in 2008, that isolates anomalies through random partitioning of the data.

It works without any labelled anomaly data and scales to high-dimensional datasets.

The intuition behind the method

The core idea is simple: anomalies are few and different, so they are easy to separate from the rest of the data. If you keep splitting the data at random, a normal point sits in a dense region and takes many cuts to isolate, whereas an outlier sits apart and gets cut off after only a few splits. Counting how many splits it takes to isolate each point turns this intuition into an anomaly score.

History

Isolation Forest was proposed by Fei Tony Liu, Kai Ming Ting and Zhi-Hua Zhou in 2008 at the IEEE International Conference on Data Mining. It introduced a different philosophy for outlier detection: rather than profiling normal data and measuring deviation, it isolates anomalies directly through random partitioning, exploiting that anomalies are few and different. The approach became a widely used, scalable tool for unsupervised anomaly detection on high-dimensional data.

When to use it

Use Isolation Forest to detect anomalies or outliers in continuous, possibly high-dimensional, cross-sectional or time-series data with at least about 50 observations, especially when you have no labelled anomalies to learn from. It needs no labelled anomaly data and scales well as the number of features grows; you supply a contamination parameter expressing the expected anomaly rate. With fewer than about 50 observations the boundary between normal and anomalous points becomes unreliable and statistical outlier methods or PCA are safer.

Limitations and considerations

  • On small samples (n below about 50) the boundary between normal and anomalous points is unclear and the false-positive rate is high.
  • Without enough genuine anomalies the contamination parameter becomes meaningless, and statistical outlier methods are preferable.
  • It returns anomaly scores rather than interpretable coefficients or explicit rules.
  • Results depend on the chosen contamination value, which must be set from domain knowledge.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Unsupervised: requires no labelled anomaly data to flag outliers.
  • Scales well to high-dimensional data.
  • Isolates anomalies directly rather than modelling the whole normal distribution, which keeps it efficient.
  • A single contamination parameter expresses the expected anomaly rate and sets the flagging threshold.

Applications

  • Unsupervised outlier and anomaly detection in continuous data.
  • Screening high-dimensional datasets where no labelled anomalies exist.
  • Flagging unusual observations in cross-sectional or time-series data before modelling.
  • Data-quality checks and exploratory detection of irregular records.

How it works

How it works

1

Isolation Forest reverses the usual logic of outlier detection. Instead of building a profile of normal points and flagging whatever deviates from it, it directly exploits the fact that anomalies are few and different and therefore quicker to isolate. Because it needs no labelled anomalies, it is fully unsupervised, and it scales well to high-dimensional data.

2

The method builds many random partitioning trees. In each tree the data is recursively split by choosing a feature at random and a random split value, carving the space into smaller and smaller regions until every point sits alone. Isolating a normal point — buried in a crowded region — requires many such partitions, while an anomaly out on its own is separated after only a few.

3

Each point's path length — the number of splits needed to isolate it — is averaged across the forest and converted into an anomaly score: short average paths mean likely anomalies, long paths mean likely normal points. A contamination parameter, the expected proportion of anomalies, sets the threshold that decides which points are finally flagged as outliers.

Formula
s(x) = 2^{-\frac{E(h(x))}{c(n)}}

Common pitfalls

  • Running it on fewer than about 50 observations and trusting the flagged anomalies.
  • Setting the contamination parameter without enough actual anomalies in the data to support it.
  • Treating the anomaly scores as exact probabilities rather than a relative ranking.
  • Ignoring feature scaling and the influence of irrelevant features on the random splits.

Frequently asked questions

Do I need labelled anomalies to use Isolation Forest?

No. It is an unsupervised method that isolates anomalies through random partitioning, so it needs no labelled anomaly data to operate.

What does the contamination parameter do?

It expresses the expected proportion of anomalies in the data and sets the threshold that decides which points are finally flagged as outliers. Without enough genuine anomalies in the data, this parameter becomes meaningless.

Why does it struggle on small samples?

With fewer than about 50 observations the boundary between normal and anomalous points is unclear and the false-positive rate is high. In that case statistical outlier methods or PCA are safer alternatives.

How are anomalies scored?

Each point's average path length across the random trees — how many splits it took to isolate — is turned into an anomaly score. Short average paths indicate likely anomalies; long paths indicate likely normal points.

Related methods

Sources

  1. Liu, F.T., Ting, K.M. & Zhou, Z.-H. (2008). Isolation Forest. IEEE ICDM, 413–422.

    Open DOI reference
    Copied.