Learning to Rank Anomalies: Scalar Performance Criteria and Maximization of Two-Sample Rank Statistics

Myrto Limnios, Nathan Noiry, Stéphan Clémençon

Introduction

In many critical domains, such as fraud detection, cybersecurity, and predictive maintenance, the primary goal is not just to classify observations as "normal" or "abnormal," but to rank them by their degree of abnormality. However, anomaly detection is inherently unsupervised; we rarely have access to ground-truth labels for outliers during the training phase. This paper introduces a novel framework that bridges the gap between unsupervised anomaly detection and supervised ranking by transforming the problem into a two-sample rank statistic maximization task.

The Mass-Volume Criterion

In the absence of labels, the standard evaluation metric is the Mass-Volume (MV) curve. The MV curve is the unsupervised counterpart to the Receiver Operating Characteristic (ROC) curve. It measures the volume of the region required to capture a certain amount of probability mass. An optimal scoring function is one that minimizes this volume for any given mass, effectively finding the most concentrated regions of the data distribution.

Figure 1: A typical Mass-Volume (MV) curve. The goal is to minimize the area under this curve, ensuring the distribution's mass is contained within the smallest possible volume.

While the MV curve is a powerful theoretical tool, it is a complex functional object that is difficult to optimize directly. The authors propose a scalar performance criterion that serves as a proxy for the MV curve, allowing for direct optimization via gradient-based methods.

Methodology: Ranking via Synthetic Outliers

The proposed framework operates in two main stages:

  1. Synthetic Outlier Generation: To simulate a supervised environment, the authors generate a second sample of "proxy" outliers. These are typically drawn from a uniform distribution over a region encompassing the normal data. This turns the unsupervised task into a binary classification-like problem.
  2. Rank Statistic Maximization: Instead of standard classification, the authors maximize two-sample linear rank statistics, denoted as $W_\phi$. This criterion weights the ranks of the normal observations relative to the synthetic outliers. Mathematically, minimizing the area under the MV curve is shown to be equivalent to maximizing specific rank-sum statistics, such as the Wilcoxon Mann-Whitney test.

To implement this, the authors utilize a Neural Network (MLP) trained with a hybrid loss function. This loss combines standard Binary Cross-Entropy (BCE) with a regularized version of the $W_\phi$ rank-based criterion.

The Role of Score-Generating Functions

A key innovation in this framework is the use of a score-generating function, $\phi$. This function determines how different parts of the rank distribution are weighted, providing a flexible "knob" for researchers to tune the model's sensitivity.

Figure 2: Various score-generating functions $\phi$ used in statistical tests to prioritize different segments of the rank distribution.

For example, certain choices of $\phi$ might prioritize high precision at the very top of the anomaly list (identifying the most extreme outliers), while others might focus on accurately defining the boundary of the normal data distribution.

Results and Insights

The method was validated using synthetic 2D datasets, where a normal Gaussian core was surrounded by radial outliers. The experiments yielded several key insights:

  • Performance Synergy: Integrating the $W_\phi$ rank-based penalty with standard BCE loss significantly improved the model's ability to push true outliers to the bottom of the ranked list.
  • High Precision: The model demonstrated exceptional accuracy at the extremes. For the top 25 observations flagged as most abnormal, the model achieved a 91% accuracy in identifying true outliers.
  • Density Learning: Empirical heatmaps of the learned scores confirmed that the model successfully captured the underlying density structure, assigning high scores to the Gaussian core and lower scores to the periphery.

Conclusion and Future Work

By leveraging synthetic outliers and rank statistics, this research provides a robust mathematical foundation for anomaly ranking. While highly effective in low-dimensional settings, the authors note the "curse of dimensionality" as a primary hurdle. In high-dimensional spaces, generating synthetic outliers that meaningfully cover the support of the normal distribution becomes computationally expensive. Future research will likely focus on more efficient outlier generation techniques and the application of different $\phi$ functions to complex, high-dimensional real-world data.

Summary updated

BibTeX
@inproceedings{limnios2021learning,
  author = {Myrto Limnios and Nathan Noiry and Stéphan Clémençon},
  title = {{Learning to Rank Anomalies: Scalar Performance Criteria and Maximization of Two-Sample Rank Statistics}},
  booktitle = {LIDTA@ECML/PKDD},
  year = {2021},
}
Figure