Anomaly Detection using One-Class Neural Networks.

Raghavendra Chalapathy, Aditya Krishna Menon, Sanjay ChawlaarXiv 2018

TL;DR

This paper introduces One-Class Neural Networks (OC-NN), an unsupervised anomaly detection framework that integrates a one-class SVM objective directly into a deep learning architecture. By optimizing feature representation and the anomaly detection boundary simultaneously, OC-NN overcomes the limitations of traditional hybrid models to deliver robust performance on complex datasets like CIFAR-10 and adversarial traffic sign images.

What Problem Does This Paper Address?

Anomaly detection—identifying data points that deviate significantly from the norm—is crucial for applications like fraud detection, network intrusion detection, and fault diagnosis. Traditional methods like One-Class Support Vector Machines (OC-SVM) work exceptionally well on low-dimensional data but struggle with complex, high-dimensional datasets like images.

To bridge this gap, researchers often deploy "hybrid" approaches: they train a deep autoencoder to extract compact features from data and then feed those features into a standalone OC-SVM. However, this setup is fundamentally sub-optimal. Because the feature learning process is completely decoupled from the anomaly detection objective, the hidden layers have no mechanism to customize representations specifically for spotting outliers. The authors set out to design a method where representation learning and anomaly detection are driven by the exact same objective.

Methods

The authors propose OC-NN, a framework that natively embeds a one-class objective function into a feed-forward neural network training loop.

Instead of computing the standard dot product map used in traditional OC-SVMs, OC-NN replaces it with a neural network hidden layer representation:

$$\langle w, g(VX) \rangle$$

where $V$ represents the weights from the input to the hidden layer, $g(\cdot)$ is the activation function, and $w$ is the output weight scalar. This architecture draws a tight hyperplane envelope separating normal data points from the origin.

To train this non-convex objective, the authors introduce an alternating minimization algorithm:

  1. Optimize Weights: Fix the bias parameter $r$ and update the network weights ($w$ and $V$) using standard backpropagation.
  2. Optimize Bias: Update $r$ by computing the $\nu$-quantile of the data scores. The authors elegantly prove that this subproblem reduces to a simple, computationally efficient quantile selection problem.
Model architecture comparison between a standard Autoencoder and the proposed OC-NN pipeline.

Datasets

The model was evaluated across a mix of synthetic and real-world computer vision benchmarks:

  • Synthetic Data: 190 normal points and 10 anomalous points (512 dimensions) to validate basic functionality.
  • MNIST: 60,000 grayscale handwritten digit images (28×28), where single digit classes serve as normal data, contaminated with 1% anomalies from other classes.
  • CIFAR-10: 60,000 complex color images (32×32) across 10 classes, using a 10% anomaly contamination rate.
  • GTSRB (German Traffic Sign Recognition Benchmark): 1,050 normal stop sign images contaminated with 100 adversarial images generated via a Boundary Attack.

Key Insights and Ideas

  • End-to-End Customization: The core "aha" moment is that feature extraction shouldn't be task-agnostic. By forcing hidden layers to be driven by the one-class objective, the network learns to discard background noise and focus purely on features relevant to distinguishing normal data from anomalies.
  • Quantile Selection Equivalence: Proving that the bias update step is exactly equivalent to finding a specific quantile of the network's output scores makes the optimization algorithm highly practical and fast to execute.
  • Global vs. Local Structure: Deep models like OC-NN excel when data lacks global contrast but possesses intricate local structures (such as the AUTOMOBILE, BIRD, and DEER classes in CIFAR-10). Conversely, shallow models can still win if the normal class has a very rigid, simple global structure (like TRUCK images, which are consistently split horizontally into street and sky).

Key Results

  • Synthetic Sanity Check: OC-NN perfectly separated all 10 anomalies with clear negative decision scores, performing on par with classical OC-SVM.
  • CIFAR-10 Robustness: OC-NN demonstrated highly robust performance across complex classes. For instance, on the AUTOMOBILE class, it achieved a 61.97% AUC, outperforming shallow baselines and matching or beating other deep alternatives like Deep SVDD. On the BIRD class, it achieved 63.66% AUC.
  • GTSRB Adversarial Detection: When tasked with identifying adversarial stop signs, OC-NN achieved an AUC of 63.53%, significantly outperforming shallow baselines like traditional OC-SVM (52.5%) and Kernel Density Estimation (51.5%), though it trailed behind the Robust Convolutional Autoencoder (RCAE), which led at 87.39%.

Limitations and Future Work

  • Non-Convexity: Because the objective function incorporates non-linear neural network layers, it is inherently non-convex. The alternating minimization algorithm can get trapped in local optima, making the model sensitive to weight initialization.
  • Architectural Dependence: The success of OC-NN heavily relies on choosing the right network architecture for the target dataset. If the network capacity or design is poorly matched to the data's structural properties, performance can degrade compared to simpler shallow methods.
  • Future Directions: The authors note that extending this formulation to deeper architectures and exploring its utility on complex sequential/time-series datasets are natural next steps.

Summary updated

BibTeX
@misc{chalapathy2018anomaly,
  author = {Raghavendra Chalapathy and Aditya Krishna Menon and Sanjay Chawla},
  title = {{Anomaly Detection using One-Class Neural Networks.}},
  year = {2018},
  eprint = {1802.06360},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.06360},
}
Figure