Is AUC the best measure for practical comparison of anomaly detectors?

Vít Skvára, Tomás Pevný, Václav SmídlarXiv 2023 · DOI · OpenReview

Introduction

Area Under the ROC Curve (AUC) is widely considered the "gold standard" for evaluating anomaly detectors. It provides a single, threshold-independent value to rank models. However, this research suggests that AUC may be leading the field astray. For practitioners in security or industrial engineering, performance at high False Positive Rates (FPR) is irrelevant due to limited investigation budgets. This paper audits standard metrics and proposes more robust alternatives for real-world applications.

The Limitations of Standard AUC

The core issue is that AUC integrates performance over all possible thresholds, giving equal weight to a 50% FPR—which is useless in practice—as it does to a 0.01% FPR. Furthermore, anomaly detection assumes future threats are unknown, yet AUC is typically calculated using "representative" samples. If these samples do not match future anomalies, AUC scores can become dangerously misleading, potentially ranking a poor model above a superior one for practical use.

Methods and Alternative Metrics

The researchers compared standard AUC against several metrics designed to reflect practitioner constraints:

  • Partial AUC ($AUC@\alpha$): AUC calculated only up to a specific, low FPR (e.g., 0.05).
  • Weighted AUC ($AUC_w$): An integral that places significantly more weight on the low FPR region.
  • Precision@k and TPR@$\alpha$: Metrics reflecting specific operational "budgets."
  • Volume of the Decision Region ($VOL@\alpha$): A measure of how tightly a model encloses "normal" data, which does not require anomaly labels for evaluation.
Illustration of Partial AUC ([email protected]$) and TPR at a fixed False Positive Rate.

These metrics were tested across 172 datasets derived from UCI repository sources, using four popular algorithms: k-Nearest Neighbors (kNN), Local Outlier Factor (LOF), Isolation Forest (IF), and One-Class SVM (OC-SVM).

Key Results: The "Worst" Choice for Selection

The study measured "Relative Loss"—the performance drop experienced when a model is selected using one metric (e.g., AUC) but evaluated on another (e.g., Precision@k).

Experiments revealed that selecting models based on the highest standard AUC consistently resulted in the highest relative loss across nearly all practical scenarios. In contrast, $AUC_w$ and [email protected]$ proved to be much more reliable proxies for application-specific needs. As shown in the comparison below, standard AUC can fail to reward models that perform exceptionally well in the critical low-FPR regime.

Comparison of standard AUC and Weighted AUC ($AUC_w$) for two different models. The dashed line has a lower standard AUC but a higher $AUC_w$ due to superior performance at low FPR.

In "mismatch" experiments, where validation anomalies differed from test anomalies, supervised metrics like AUC failed entirely. However, the Volume ($VOL@\alpha$) metric remained stable, correctly identifying models that effectively "wrapped" the normal data regardless of the specific anomaly type encountered.

Conclusion

The findings suggest that [email protected]$ is a "crude but robust" alternative to standard AUC for model selection. For high-stakes environments where future anomalies are unpredictable, the Volume metric offers a safer, albeit computationally expensive, evaluation path. Ultimately, the sensitivity of anomaly detection to validation samples suggests a necessary shift toward active or few-shot learning to incorporate human feedback into the definition of what constitutes a relevant anomaly.

Summary updated

Abstract

The area under receiver operating characteristics (AUC) is the standard measure for comparison of anomaly detectors. Its advantage is in providing a scalar number that allows a natural ordering and is independent on a threshold, which allows to postpone the choice. In this work, we question whether AUC is a good metric for anomaly detection, or if it gives a false sense of comfort, due to relying on assumptions which are unlikely to hold in practice. Our investigation shows that variations of AUC emphasizing accuracy at low false positive rate seem to be better correlated with the needs of practitioners, but also that we can compare anomaly detectors only in the case when we have representative examples of anomalous samples. This last result is disturbing, as it suggests that in many cases, we should do active or few-show learning instead of pure anomaly detection.
BibTeX
@misc{skvara2023is,
  author = {Vít Skvára and Tomás Pevný and Václav Smídl},
  title = {{Is AUC the best measure for practical comparison of anomaly detectors?}},
  year = {2023},
  eprint = {2305.04754},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.04754},
}
Figure