Text & documents
Numbers & maths
Data & formats
Security
Development & DevOps
Artificial Intelligence
Finance
Health & Wellness
Productivity
Games & Entertainment
Multimedia & design
Business
How to use
What an anomaly is (and why there is no single detector)

An anomaly is a point that doesn't look like the rest. Without labels there is no correct answer: each detector has its own idea of «odd». They all give a rarity score; the contamination says what fraction to flag (the highest scores). In the examples the true anomalies are known (triangles), so each detector can be measured by its AP (how well it ranks: 1 = all the anomalies first).

The four detectors

• Robust z-score: how far each variable is from its median, in units of MAD (resistant to the anomalies themselves).
• IQR (Tukey's box-plot rule): what falls outside [Q1 − 1.5·IQR, Q3 + 1.5·IQR].
Both look at each variable separately and at the whole set at once: they don't see a point that is odd because of the COMBINATION of variables, nor one that is odd only for its neighbourhood.
• LOF (local outlier factor): compares each point's density with that of its k neighbours; it sees what is odd «locally». With a small k, a small group of anomalies keeps each other company and passes as normal.
• Isolation Forest: trees that split at random; what is odd gets isolated in few cuts. Fast and distance-free, but it cuts parallel to the axes and struggles with correlated variables.

With your data

In «Your points» paste two numeric columns (x, y), one row per line, separated by comma, semicolon or tab; lines that aren't (a header) are ignored. The true anomalies aren't known, so there is no AP: compare what each detector flags. Everything is computed in your browser.

Anomaly detectionz-score, IQR, LOF and Isolation Forest
Anomaly detectionz-score, IQR, LOF and Isolation Forest

The true anomalies are next to the dense group: closer to a centre than many normal points of the sparse group. z-score and IQR only look at how far each point is from everything, so they flag the edges of the sparse group; LOF compares each point with ITS neighbourhood and finds them.