ISOLATION FOREST · OUTLIER AND ANOMALY DETECTION · MANY COLUMNS AT ONCE · RUNS IN YOUR BROWSER · NOTHING UPLOADED

Which rows of my data are unusual?

Paste a table: customers and what they spend, orders, expense lines, sensor readings, lab measurements. An isolation forest (Liu, Ting & Zhou 2008) cuts the data at random, again and again, and counts how many cuts it takes to leave each row on its own. Unusual rows are isolated in a few cuts, ordinary ones take many.

You get every row ranked by anomaly score, the rows flagged as anomalies, and the columns that make each of the top rows stand out. It looks at all your numeric columns together, so it also finds rows whose combination of values is rare.

Nothing you enter leaves this browser tab. Statistical output from data you supply, not advice. Not legal, tax, or financial advice.

Your data

Missing cells are filled with the column median. ID columns and codes with three or fewer values are left out unless you tick them.

Columns to use as features
Paste data to choose columns.

Method and citation

The isolation forest (Liu, Ting & Zhou 2008; journal version 2012) starts from two facts about anomalies: they are few and they are different. Each of t = 100 trees is grown on ψ = 256 rows drawn at random without replacement. At each node it picks a column at random and cuts at a value drawn uniformly between that column's minimum and maximum among the node's rows, and it stops when one row is left, the rows are identical, or the depth reaches ⌈log₂ ψ⌉ = 8. A row's path length h(x) is the number of cuts on its way down, plus c(size) for the rows still sharing its leaf, where c(n) = 2H(n − 1) − 2(n − 1)/n is the average path length of an unsuccessful search in a binary search tree and H(i) ≈ ln i + 0.5772.

The anomaly score is s(x, ψ) = 2^(−E[h(x)] / c(ψ)), where E[h(x)] is the average over the trees. A row isolated at the average depth scores 0.5; one isolated at once scores near 1. Flagging rows above 0.5 is the rule scikit-learn uses when its contamination is auto.

Two choices the paper leaves open: a column that is constant within a node is never picked (it cannot split), and missing cells are filled with the column median before the trees are grown. “What stands out” (robust z-scores per column) is a description added for readers, not part of the method.

Verified by tests in the source against scikit-learn 1.9.1's IsolationForest. The two use different random number generators, so the check is on the expected score: with 20,000 trees, every row of three public datasets (this page's example, UCI Ionosphere and UCI Breast Cancer Wisconsin) agrees to within 0.0034, the same size as the gap between two runs of this tool with different seeds. At the default 100 trees the mean AUC over seeds agrees too: 0.855 on Ionosphere and 0.985 on Breast Cancer Wisconsin, as in scikit-learn. The constant c(n) matches scikit-learn's to 1e-12.

BibTeX

@inproceedings{liu2008isolation,
  author    = {Liu, Fei Tony and Ting, Kai Ming and Zhou, Zhi-Hua},
  title     = {Isolation Forest},
  booktitle = {Proceedings of the 8th IEEE International Conference on Data Mining (ICDM)},
  pages     = {413--422}, year = {2008},
  doi       = {10.1109/ICDM.2008.17}
}
@article{liu2012isolation,
  author  = {Liu, Fei Tony and Ting, Kai Ming and Zhou, Zhi-Hua},
  title   = {Isolation-Based Anomaly Detection},
  journal = {ACM Transactions on Knowledge Discovery from Data},
  volume  = {6}, number = {1}, pages = {3:1--3:39}, year = {2012},
  doi     = {10.1145/2133360.2133363}
}

Limits

Questions

What does an isolation forest do?

It ranks rows by how easy they are to separate from the rest. It cuts the data again and again at random: a random column, at a random value between that column's smallest and largest. An unusual row ends up alone after a few cuts; an ordinary row, surrounded by similar ones, takes many. Averaged over 100 random trees, few cuts means a high anomaly score.

How do I read the anomaly score?

Scores run from 0 to 1. Near 1, the row was isolated almost at once: an anomaly. Well below 0.5, it is an ordinary row. If every row scores close to 0.5, the data has no distinct anomaly. The tool flags rows above 0.5 by default, the same rule as scikit-learn's contamination set to auto.

What does contamination mean?

The share of rows you expect to be anomalies. Choose 5% and the tool flags the 5% of rows with the highest scores, whatever their scores are. Leave it on auto to flag every row scoring above 0.5 instead. It changes only where the line is drawn, never the scores or the ranking.

Why is a row flagged when none of its values is extreme?

Because the combination is rare. A customer with average spending on milk and average spending on detergent may still be the only one with that particular mix. The table lists columns two or more robust standard deviations from the median; when it lists none, the row is unusual only jointly.

Do I need to scale or normalise my columns first?

No. Each cut is drawn between a column's own minimum and maximum, so multiplying a column by a constant or adding one to it leaves every score unchanged. A log transform does change the result. On the example, the ten highest scores on the raw amounts are all big spenders; after taking the logarithm of each amount, eight of the top ten are customers who buy almost nothing in one or two product groups.

Why do the scores change a little when I change the seed?

The trees are random. With 100 trees a row's score typically moves by about 0.01 between seeds, so rows with nearly equal scores can swap places. Raise the number of trees for steadier scores. The same seed always gives the same result.

Is my data uploaded anywhere?

No. The file is read and scored by JavaScript in this browser tab. There are no accounts, cookies or analytics vendors.

Example data: Wholesale customers, annual spending in monetary units by 440 clients of a wholesale distributor in Portugal on six product groups, from the UCI Machine Learning Repository (Cardoso, M. (2013), doi:10.24432/C5030X), under CC BY 4.0, retrieved 2026-11-13. The Channel and Region columns are codes and are left out by default.