Angle-based outlier detection

Also known as: ABOD

On this page 7

Angle-based outlier detection (ABOD) is an unsupervised anomaly detection method that scores each data point by the variance of the angles it forms with pairs of other points, treating points with a low angle variance as likely outliers. It was introduced by Kriegel, Schubert and Zimek in 2008 as an answer to the weakness of distance-based methods in high-dimensional spaces.

The intuition is geometric. A point deep inside a cluster sees other points in all directions, so its angles vary widely. A point far outside the data sees almost everything in one narrow direction, so its angles barely change.

How the angle-based outlier factor is computed

ABOD computes for each point A an angle-based outlier factor (ABOF), defined as the variance, over all pairs of other points B and C, of the cosine-like term between the difference vectors AB and AC. Each term is the scalar product of AB and AC divided by the squared lengths of both vectors, which gives a value related to the angle but additionally weighted by distance.

The distance weighting matters. Dividing by squared lengths makes nearby pairs contribute more than remote ones, so local structure influences the score without making it a pure distance measure. Once all ABOF values are computed, points are ranked in ascending order: the smallest ABOF values mark the strongest outlier candidates.

The table shows how typical point positions translate into angle spectra and scores.

Point positionAngle spectrumABOF valueInterpretation
Cluster centerVery wide, all directionsHighClear inlier
Cluster borderModerately wideMediumUsually an inlier
Isolated far pointNarrow, one directionLowStrong outlier
Point between clustersPartly narrowMedium to lowPossible outlier, inspect
Point position and resulting ABOF behavior

Why angles help in high-dimensional data

Angles remain informative in high dimensions where distances lose contrast. As dimensionality grows, the ratio between the nearest and farthest neighbor distances tends toward one, an effect known as distance concentration within the curse of dimensionality. Methods that rely on k-nearest-neighbor distances or local density then struggle to separate outliers from ordinary points.

The variance of angles depends on the relative direction of the surrounding data rather than on absolute distances alone, so it degrades more slowly. This made ABOD one of the first methods designed specifically for high-dimensional outlier detection. Later studies showed that its advantage is real but not unlimited: when many dimensions are pure noise, angles also concentrate.

A useful way to see the difference is to consider a point that lies far from every cluster in a space with hundreds of attributes. Its distance to the nearest neighbor may look only slightly larger than average, because all distances have become similar. The directions toward the other points, however, still fall inside a narrow cone, and the low variance of those angles exposes the point even when distance contrast is weak.

CriterionLow dimensionsHigh dimensions
Nearest-neighbor distanceClear contrast between pointsDistances become nearly equal
Local density ratioReliable cluster boundariesDensity estimates grow unstable
Angle varianceReliable but costlyDegrades more slowly than distance
Effect of rising dimensionality on detection criteria

Variants and computational cost

Exact ABOD is expensive because it evaluates every pair of other points for every point, which gives cubic time complexity, O(n³) in the number of points. Several approximations make the method usable on larger datasets.

VariantApproachTime complexityTrade-off
ABOD (exact)All point pairs per pointO(n³)Most accurate, impractical beyond a few thousand points
FastABODPairs among the k nearest neighbors onlyAbout O(n² + n·k²)Much faster, depends on choice of k
LB-ABODLower bounds to prune clear inliersExact for top candidatesSpeeds up top-m ranking
Random projection approximationsEstimate angle variance from sketchesNear-linear in practiceApproximation error to control
ABOD variants and their trade-offs

FastABOD is the version most libraries implement by default, including PyOD, where the number of neighbors is the key parameter. Small values of k emphasize local outliers, while large values approach the global behavior of exact ABOD at higher cost.

ABOD belongs to the classical family of proximity-based detectors, but its geometric criterion distinguishes it from distance and density approaches. The comparison helps decide when it is the right tool.

MethodCore criterionStrengthWeakness
ABODVariance of weighted anglesRobust to moderate dimensionalityExpensive, no native threshold
k-NN anomaly detectionDistance to k-th neighborSimple, intuitiveLoses contrast in high dimensions
Local outlier factorRelative local densityHandles clusters of varying densitySensitive to neighborhood size
Isolation forestPath length in random treesFast, scales wellWeaker on axis-aligned structure
ECODEmpirical tail probabilities per featureParameter-free, fastIgnores feature interactions
ABOD compared with other unsupervised detectors

In benchmark collections, no single detector dominates. ABOD tends to perform well on moderately dimensional numeric data with compact clusters and less well on data dominated by irrelevant noise features.

Practical use and limitations

Applying ABOD well requires careful preprocessing and realistic expectations about scale. The following points summarize practical experience.

  • Scale features first: because the score uses vector lengths, features with large ranges dominate unless standardized.
  • Remove duplicates: identical points produce zero-length vectors and undefined terms.
  • Set a contamination rate or threshold: ABOF values have no natural cutoff, so a ranking must be converted into decisions.
  • Watch the dataset size: exact ABOD becomes impractical beyond a few thousand points; use FastABOD or sampling.
  • Numeric data only: categorical attributes need encoding, which can distort angles.

Because raw ABOF values span several orders of magnitude, many pipelines apply a logarithmic or rank transformation before combining ABOD with other detectors in an ensemble. Reporting the points that contribute most to a low score also supports anomaly explanation, since analysts can see which neighbors define the narrow angle cone. Evaluation should use labeled incidents where available and metrics such as precision at the top ranks, because overall accuracy hides poor performance on rare anomalies.

Put simply

Picture a crowd standing in a square. A person in the middle sees people in front, behind and on both sides. A person standing far away at the edge of town sees the whole crowd in one direction only.

Angle-based outlier detection uses exactly this idea. For each data point, it looks at the directions toward all other points. If those directions vary widely, the point is part of the crowd. If they all point the same way, the point is probably an outlier.

In practice

A quality engineer at an electronics plant monitors circuit boards with 48 numeric test measurements each, such as voltages, currents and timing values. Distance-based screening flagged too many normal boards, because in 48 dimensions most boards looked roughly equally far from each other.

The engineer standardizes all measurements, removes exact duplicate records and applies FastABOD with 20 neighbors to a daily batch of about 6,000 boards. The 0.5% of boards with the lowest ABOF scores go to manual inspection. Over several weeks, this list contains a markedly higher share of genuinely faulty boards than the previous distance threshold, and the inspection team spends less time on false alarms.