Fast and Exact Outlier Detection in Metric Spaces: A Proximity Graph-based Approach

Daichi Amagata, Makoto Onizuka, Takahiro Hara

Introduction

Distance-based Outlier Detection (DOD) is a fundamental task in data mining, used to identify anomalous observations in large datasets. Formally, a point is considered an outlier if it has fewer than $k$ neighbors within a specified distance threshold $r$. While the concept is intuitive, the computational cost is significant: a naive nested-loop approach requires $O(n^2)$ distance calculations, which is prohibitive for modern million-scale datasets.

Distance-based outlier detection: a point $p$ is an outlier if it has fewer than $k$ neighbors within radius $r$.

Existing solutions, such as VP-trees or cluster-based pruning methods like DOLPHIN and SNIF, often struggle with the "curse of dimensionality." As the number of dimensions increases, these tree-based structures lose their pruning efficiency, eventually degrading toward a slow linear scan. This paper introduces the Metric Randomized Proximity Graph (MRPG), a novel indexing structure designed to overcome these limitations by providing a fast and exact filtering mechanism.

The MRPG Framework

The proposed approach utilizes a two-phase framework: Filtering and Verification.

  1. Filtering Phase: The algorithm uses the MRPG to count neighbors for each point. During a graph traversal, if a point is found to have at least $k$ neighbors within distance $r$, it is immediately classified as an "inlier" and discarded from further consideration. This "early exit" strategy is highly effective because, in most real-world datasets, the vast majority of points are inliers.
  2. Verification Phase: Only the small subset of points that cannot be cleared during the filtering phase are passed to a verification step. Here, an exact method (such as a linear scan or a VP-tree search) is used to confirm their status.

Building the Metric Randomized Proximity Graph

The MRPG index is constructed through several specialized steps to ensure high connectivity and search efficiency:

  • NNDescent+: An enhanced graph-building algorithm that uses VP-tree partitioning for better initialization than random links.
  • Connect-SubGraphs: Ensures the graph is strongly connected, preventing searches from becoming trapped in isolated clusters.
  • Remove-Detours: A critical heuristic that creates monotonic paths. This ensures that greedy traversals can reliably find neighbors within radius $r$ without missing them due to local minima.
  • Remove-Links: Prunes the graph to maintain sparsity and memory efficiency, keeping the index size linear ($O(nk)$).

A core insight of this work is the distinction between standard Approximate Nearest Neighbor (ANN) search and the DOD problem. In ANN search, a query starts from a random entry point to find its neighbors. In DOD, the search for neighbors of a point $p$ can start from $p$ itself.

Comparison between standard Approximate Nearest Neighbor (ANN) search and the Distance-based Outlier Detection (DOD) problem. In DOD, traversal starts directly from the query point.

By starting the traversal at the point being checked, the proximity graph can find nearby neighbors much faster than a global search. Furthermore, the "Remove-Detours" step guarantees that if a neighbor exists within radius $r$, there is a high probability of finding it through a monotonic path, significantly reducing the number of false candidates passed to the verification phase.

Experimental Evaluation

The authors evaluated MRPG on seven diverse real-world datasets, including high-dimensional image descriptors (Deep, SIFT), word embeddings (Glove), and even non-coordinate data like dictionaries using Edit Distance.

Key results include:

  • Massive Speedups: MRPG achieved speedups of up to 397x over state-of-the-art algorithms on the Glove dataset.
  • Dimensionality Robustness: Unlike tree-based methods that fail on high-dimensional data (e.g., MNIST with 784 dimensions), MRPG maintained consistent performance.
  • Efficiency: The MRPG index size is linear ($O(nk)$), making it practical for main-memory processing on large datasets.
  • Scalability: The algorithm scales linearly with the number of data points and parallelizes effectively across multiple CPU threads.

Conclusion

MRPG represents a significant advancement in exact outlier detection for metric spaces. By leveraging the properties of proximity graphs and focusing on the rapid identification of inliers, the method provides a scalable, robust, and highly efficient solution for large-scale, high-dimensional data analysis.

Summary updated

BibTeX
@inproceedings{amagata2021fast,
  author = {Daichi Amagata and Makoto Onizuka and Takahiro Hara},
  title = {{Fast and Exact Outlier Detection in Metric Spaces: A Proximity Graph-based Approach}},
  booktitle = {SIGMOD},
  year = {2021},
  url = {https://openreview.net/forum?id=-vplRSq1zY_},
}
Figure