Introduction
One-Class Classification (OCC) is a fundamental task in anomaly detection, where the objective is to model "normal" behavior and identify deviations as anomalies. While traditional OCC methods require extensive datasets to define robust boundaries, many real-world applications—such as industrial fault detection or medical diagnosis—suffer from extreme data scarcity.
This paper addresses the challenge of Few-Shot One-Class Classification (FS-OCC): building an effective anomaly detector using only a handful (e.g., 5 or 10) of normal examples and zero labeled anomalies. To solve this, the authors introduce OC-MAML, a meta-learning framework that adapts Model-Agnostic Meta-Learning (MAML) specifically for the one-class regime.
Methodology: OC-MAML
Standard meta-learning algorithms like MAML are typically designed for balanced multi-class tasks. OC-MAML modifies this approach through a specialized episodic data sampling strategy designed to bridge the gap between one-class adaptation and balanced evaluation.
Episodic Sampling Strategy
- Inner Loop (Adaptation): The model is presented with a "support set" consisting exclusively of normal samples (Class Imbalance Rate = 0%). It performs a few gradient steps to adapt its parameters to this specific normal class.
- Outer Loop (Meta-Update): The adapted model is evaluated on a "query set" that is class-balanced (50% normal, 50% anomalous).
- Meta-Optimization: The objective is to find a parameter initialization such that a gradient update based solely on the normal class results in a model capable of distinguishing between normal and anomalous data.
Gradient Alignment
Theoretical analysis using Taylor expansion reveals that this sampling strategy effectively maximizes the cosine similarity between gradients derived from one-class data and those derived from balanced data. This "gradient alignment" ensures that the model's internal representation is structured so that learning the features of a normal class automatically helps define the boundary against anomalies.
Experimental Evaluation
The researchers evaluated OC-MAML across eight datasets, including image benchmarks (MiniImageNet, Omniglot, CIFAR-FS, FC100, MT-MNIST) and time-series benchmarks (STS-Sawtooth, STS-Sine, and the real-world CNC-MMD industrial dataset).
Key Results
OC-MAML demonstrated significant performance gains over both classical OCC methods and standard meta-learning baselines. On the MiniImageNet benchmark with $K=2$ samples, OC-MAML achieved 69.1% accuracy, compared to 62.3% for standard MAML and near-chance performance (50.2%) for classical One-Class SVMs.
In real-world applications, the model showed high efficacy on the CNC milling dataset (CNC-MMD), achieving F1-scores between 80% and 95.9% across various operations using only 10 normal samples. Furthermore, the authors showed that the OC-sampling strategy is algorithm-agnostic, improving the performance of other meta-learning frameworks like MetaOptNet and Meta-SGD.
Conclusion and Future Work
OC-MAML successfully enables anomaly detection in data-scarce environments by aligning one-class gradients with balanced classification objectives. While the method requires labeled anomalies during the meta-training phase, it provides a powerful initialization for few-shot deployment. Future research directions include exploring unsupervised FS-OCC, where the meta-training phase could potentially function without labeled anomalies, further reducing the supervision required for robust anomaly detection.
Summary updated