An isolation forest uses sub-samples of size and scores a point with , where . (a) Compute . (b) Find for average path lengths , and and say what each means. (c) Why is in the formula?
Unsupervised learning, Anomaly detection
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can use the isolation-forest scoring formula and explain the normalisation by .
Key idea
is the expected path length of an unsuccessful search in a binary search tree built from points, which normalises so that scores are comparable and gives .
Steps
- , so .
- For : , so . This is well above , which means that the point is isolated very quickly. It is a likely anomaly.
- For : this is almost exactly , so . The point is as hard to isolate as an average point, with no evidence of an anomaly.
- For : , so . This is a deep, well-embedded point: normal.
- Why : the average depth in a random binary tree grows like , so the raw path length depends on the sample size. Dividing by makes the score independent of .
- Limits: gives (anomaly) and gives . The score is therefore in and is compared with a threshold or the contamination rate.
Common mistakes
- Using or forgetting that the base is 2 in .
- Thinking that a score near everywhere is a bad model. It means there are no clear anomalies.
- Using the whole dataset in each tree. Sub-sampling is part of the method, and reduces swamping and masking.
How long your answer should be
Half a page; 4–5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Unsupervised learning: Five points lie on a unit half-circle at angles . Isomap uses a neighbourhood graph in which two points are joined if they are less than apart. (a) What is the graph (geodesic) distance between the first and last points, and how does it compare with the straight-line distance and the true arc length? (b) What goes wrong if the radius is too large, for example ?
Next in Unsupervised learning: In alternating least squares (ALS) for matrix factorisation, a user has rated two items, with item vectors and fixed and ratings and . (a) Derive the update that minimises for the user vector . (b) Compute for , and for . (c) Why is ALS attractive for large recommenders?