ArticleslgStudy

mathematics

Isolation forest

Isolation forest is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Isolation forest rather than just read about it. In short: Isolation forest is an unsupervised learning algorithm for anomaly detection that works on the principle of isolating anomalies, instead of the most common techniques of profiling normal points. In statistics, an anomaly (a.k.a. outlier) is an observation or event that deviates so much from other events to arouse suspicion it was generated by a different mean.

Isolation forest — main illustration
Isolation forest — illustration

Key takeaways

  • Isolation forest belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Isolation forest to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Isolation forest from memory before moving on to harder problems.

Reference excerpt

Isolation forest is an unsupervised learning algorithm for anomaly detection that works on the principle of isolating anomalies, instead of the most common techniques of profiling normal points.

In statistics, an anomaly (a.k.a. outlier) is an observation or event that deviates so much from other events to arouse suspicion it was generated by a different mean. Figure 1 gives a two-dimensional example of this distinction: the points labelled C1 and C2 sit in dense groups of normal observations, while O1 and O2 fall outside every group. Anomalies in a big dataset may follow very complicated patterns, which are difficult to detect "by eye" in the great majority of cases. This is the reason why the field of anomaly detection is well suited for the application of machine learning techniques. The most common techniques employed for anomaly detection are based on the construction of a profile of what is "normal": anomalies are reported as those instances in the dataset that do not conform to the normal profile. Isolation Forest uses a different approach: instead of trying to build a model of normal instances, it explicitly isolates anomalous points in the dataset. The main advantage of this approach is the possibility of exploiting sampling techniques to an extent that is not allowed to the profile-based methods, creating a very fast algorithm with a low memory demand.

History The Isolation Forest (iForest) algorithm was initially proposed by Liu et al. in 2008. The authors took advantage of two quantitative properties of anomalous data points in a sample, that is:

they are the minority consisting of fewer instances and they have attribute-values that are very different from those of normal instances Since anomalies are typically few and very different from the other points in the sample, they must be easier to "isolate" compared to normal points. On the basis of this principle, Isolation Forest builds an ensemble of "Isolation Trees" (iTrees) for the data set and marks as anomalies the points that have short average path lengths on the iTrees.

Algorithm

At the basis of the Isolation Forest algorithm there is the tendency of anomalous instances in a dataset to be easier to separate from the rest of the sample (isolate), compared to normal points. In order to isolate a data point the algorithm recursively generates partitions on the sample by randomly selecting an attribute and then randomly selecting a split value for the attribute, between the minimum and maximum values allowed for that attribute.

Figures 2 and 3 show this partitioning applied to a two-dimensional dataset of normally distributed points: Figure 2 isolates a point sitting deep in a region of normal data, and Figure 3 isolates a point that lies away from those regions. It is apparent from the pictures how anomalies require fewer random partitions to be isolated, compared to normal points. From a mathematical point of view, recursive partitioning can be represented by a tree structure named Isolation Tree, while the number of partitions required to isolate a point can be interpreted as the length of the path, within the tree, to reach a terminating node starting from the root. A point lying outside the dense regions is separated from the rest of the sample by fewer splits than a point buried among similar neighbours, so its path to a terminating node is the shorter of the two (compare Figures 2 and 3). More formally, let X = { x1,..., xn } be a set of d-dimensional points and X' ⊂ X a subset of X. An Isolation Tree (iTree) is defined as a data structure with the following properties:

for each node T in the Tree, T is either an external-node with no child, or an internal-node with one "test" and exactly two daughter nodes (Tl, Tr) a test at node T consists of an attribute q and a split value p such that the test q < p determines the traversal of a data point to either Tl or Tr. In order to build an iTree, the algorithm recursively divides X' by randomly selecting an attribute q and a split value p, until either (i) the node has only one instance or (ii) all data at the node have the same values. When the iTree is fully grown, each point in X is isolated at one of the external nodes. Intuitively, the anomalous points are those (easier to isolate, hence) with the smaller path length in the tree, where the path length h(xi) of point xi∈X is defined as the number of edges xi traverses from the root node to get to an external node. A probabilistic explanation of iTree is provided in the iForest original paper.

… excerpt ends here. Continue reading the full article.

Illustrations

Isolation forest: Figure 1. Anomalies lie away from the dense regions of a dataset, so random partitioning tends to separate them after fewer splits; normal points sit inside clusters such as C1 and C2, so they require more splits to be separated.
Figure 1. Anomalies lie away from the dense regions of a dataset, so random partitioning tends to separate them after fewer splits; normal points sit inside clusters such as C1 and C2, so they require more splits to be separated.
Isolation forest: Figure 2. An example of isolating a non-anomalous point in a 2D Gaussian distribution
Figure 2. An example of isolating a non-anomalous point in a 2D Gaussian distribution
Isolation forest: Figure 3. An example of isolating an anomalous point in a 2D Gaussian distribution
Figure 3. An example of isolating an anomalous point in a 2D Gaussian distribution

Worked examples

Example 1 — a first encounter with Isolation forest

Start with the simplest possible case. Write down what Isolation forest claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Isolation forest before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Isolation forest ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Isolation forest

In research
Isolation forest appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Isolation forest in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Isolation forest is common in secondary-school and first-year university syllabi. It links to neighbouring topics Statistical outliers, Unsupervised learning, so understanding it makes those chapters shorter.
In everyday life
Look for Isolation forest outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Isolation forest” →

How to study Isolation forest in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Isolation forest means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Isolation forest out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Isolation forest in simple terms?

Isolation forest is an unsupervised learning algorithm for anomaly detection that works on the principle of isolating anomalies, instead of the most common techniques of profiling normal points. In statistics, an anomaly (a.k.a. outlier) is an observation or event that deviates so much from other e…

Why does Isolation forest matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Isolation forest?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Isolation forest.

Tags

  • Statistical outliers
  • Unsupervised learning

Keep exploring