Abstract
We propose a non-parametric anomaly detection algorithm for high dimensional data. We score each datapoint by its average K-NN distance, and rank them accordingly. We then train limited complexity models to imitate these scores based on the max-margin learning-to-rank framework. A test-point is declared as an anomaly at α-false alarm level if the predicted score is in the α-percentile. The resulting anomaly detector is shown to be asymptotically optimal in that for any false alarm rate α, its decision region converges to the α-percentile minimum volume level set of the unknown underlying density. In addition, we test both the statistical performance and computational efficiency of our algorithm on a number of synthetic and real-data experiments. Our results demonstrate the superiority of our algorithm over existing K-NN based anomaly detection algorithms, with significant computational savings.
Introduction
Anomaly detection—identifying data points that deviate significantly from the norm—is critical for applications such as fraud detection and cybersecurity. Traditionally, practitioners have faced a trade-off between parametric methods, which are fast but often too rigid for complex data, and non-parametric methods (like K-NN), which are highly accurate but computationally expensive at test time. This paper introduces RankAD, a framework designed to provide the statistical optimality of K-NN methods with the deployment speed of simple parametric models.
The RankAD Framework
RankAD bridges the gap between accuracy and speed through a multi-stage "imitation" process:
- Scoring: The algorithm calculates the average K-NN distance for nominal training data to establish initial "anomalousness" scores.
- Quantization: These scores are simplified into $m$ discrete levels (e.g., "very normal" to "less normal").
- Learning-to-Rank: A max-margin ranker (similar to a Ranking SVM) is trained to imitate these rankings. It learns a function $g(x)$ that preserves the relative order of the K-NN scores.
- Deployment: At test time, the K-NN graph is discarded. New points are scored using the learned function $g(x)$, which is orders of magnitude faster than a neighbor search.
As shown above, even a small number of quantization levels ($m=3$) allows the model to accurately capture the underlying density structure of the data.
Experimental Evaluation
The researchers evaluated RankAD on a diverse set of benchmarks, ranging from medical data to network intrusion logs. The variety of these datasets, shown in the table below, highlights the algorithm's versatility across different dimensionalities and sample sizes.
Key Results
- Superior Accuracy: RankAD consistently matched or outperformed state-of-the-art methods. For instance, on the "Forest Cover" dataset, RankAD achieved an AUC of 0.932, surpassing iForest's 0.853.
- Massive Speedups: The primary advantage is test-time efficiency. On the "HTTP" dataset, RankAD was approximately 60x faster than density-based competitors.
- Robustness: Performance remained stable across various choices of $k$ (neighbors) and $m$ (quantization levels), simplifying hyperparameter tuning.
Conclusion
RankAD offers a theoretically optimal approach to anomaly detection that does not sacrifice speed for accuracy. While the training phase still requires an initial K-NN search, the resulting "distilled" ranker is ideal for real-time deployment. Future research may explore deep learning architectures to further scale the ranking function for extremely high-dimensional data.
Summary updated