Supervised Anomaly Detection based on Deep Autoregressive Density Estimators

Tomoharu Iwata, Yuki YamanakaarXiv 2019

Abstract

We propose a supervised anomaly detection method based on neural density estimators, where the negative log likelihood is used for the anomaly score. Density estimators have been widely used for unsupervised anomaly detection. By the recent advance of deep learning, the density estimation performance has been greatly improved. However, the neural density estimators cannot exploit anomaly label information, which would be valuable for improving the anomaly detection performance. The proposed method effectively utilizes the anomaly label information by training the neural density estimator so that the likelihood of normal instances is maximized and the likelihood of anomalous instances is lower than that of the normal instances. We employ an autoregressive model for the neural density estimator, which enables us to calculate the likelihood exactly. With the experiments using 16 datasets, we demonstrate that the proposed method improves the anomaly detection performance with a few labeled anomalous instances, and achieves better performance than existing unsupervised and supervised anomaly detection methods.

Introduction

Anomaly detection is a fundamental task in machine learning, often framed as identifying rare items, events, or observations which raise suspicions by differing significantly from the majority of the data. Traditionally, this is approached via unsupervised density estimation, where a model learns the distribution of "normal" data and flags low-probability regions. While flexible, this approach fails to incorporate specific knowledge from known anomalies. Conversely, standard supervised classification treats detection as a binary task but often fails due to extreme class imbalance; anomalies are, by definition, rare, making it difficult for classifiers like SVMs or standard Neural Networks to generalize from just a few examples.

Methodology: Hybrid Density-Ranking

The proposed method bridges this gap by combining deep autoregressive density estimators with a supervised ranking loss. The core architecture utilizes Masked Autoencoder for Distribution Estimation (MADE), which allows for the exact calculation of data point likelihoods ($p(x|\theta)$), a significant advantage over approximate methods like Variational Autoencoders (VAEs).

Comparison of anomaly detection paradigms: (a) Unsupervised, (b) Supervised, and (c) the Proposed Method.

The model's anomaly score is defined as the negative log-likelihood ($-\log p(x)$). To integrate supervision, the authors introduce a novel loss function that acts as a differentiable proxy for the Area Under the ROC Curve (AUC). This loss forces the model to satisfy a ranking constraint: the probability density of a normal instance ($x_n$) should be significantly higher than that of an anomalous instance ($x_{n'}$).

The differentiable ranking loss function $f$ used to penalize instances where anomalous likelihood exceeds normal likelihood.

As shown in the figure above, the function $f$ maps the log-likelihood ratio to a value between 0 and 1. By minimizing this loss, the model is trained to ensure that $p(x_n|\theta) \gg p(x_{n'}|\theta)$. This approach allows the density estimator to act as a stabilizer, preventing overfitting to the few available anomaly labels by grounding the model in the distribution of the majority normal data.

Experimental Evaluation

The researchers evaluated the method across 16 diverse datasets, including medical (Annthyroid, Arrhythmia), security (KDDCup99), and physical sensor data (Waveform, Satellite). The experiments specifically targeted the "low-label" regime, training with only 1, 3, or 5 labeled anomalous instances.

Key Results

  • Superior Performance with Few Labels: With only 3 labeled anomalies, the proposed method achieved an average AUC of 0.839, outperforming both the unsupervised MADE (0.807) and supervised SVMs (0.804).
  • Robustness to Imbalance: Unlike standard classifiers that showed high variance and poor performance on specific datasets like Arrhythmia when labels were scarce, the proposed method remained stable by leaning on its underlying density estimation.
  • Scalability: Performance improved consistently as the number of labeled anomalies increased, demonstrating effective information absorption.

Conclusion

By integrating supervised ranking into a deep autoregressive framework, this method provides a robust solution for anomaly detection in data-scarce environments. It effectively generalizes unsupervised density estimation while leveraging the power of few-shot supervision. Future work may explore more complex backbones like Flow-based models or extension into fully semi-supervised settings with large unlabeled pools.

Summary updated

BibTeX
@misc{iwata2019supervised,
  author = {Tomoharu Iwata and Yuki Yamanaka},
  title = {{Supervised Anomaly Detection based on Deep Autoregressive Density Estimators}},
  year = {2019},
  eprint = {1904.06034},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1904.06034},
}
Figure