Organizations: the School of Statistics and Mathematics, Yunnan University of Finance and Economics, Kunming 650221, China · the Academy for Multidisciplinary Studies, Capital Normal University, Beijing 100048, China
Anomaly detection is a crucial machine-learning task with wide-ranging applications. Deep Support Vector Data Description (Deep SVDD) is a prominent deep one-class method, but it is vulnerable to hypersphere collapse, often relies on heuristic choices for hypersphere parameters, and provides limited interpretability. To address these issues, we propose Interpretable Maximum Margin Deep Anomaly Detection (IMD-AD), which leverages a small set of labeled anomalies and a maximum margin objective to stabilize training and improve discrimination. It is inherently resilient to hypersphere collapse. Furthermore, we prove an equivalence between hypersphere parameters and the network's final-layer weights, which allows the center and radius to be learned end-to-end as part of the model and yields intrinsic interpretability and visualizable outputs. We further develop an efficient training algorithm that jointly optimizes representation, margin, and final-layer parameters. Extensive experiments and ablation studies on image and tabular benchmarks demonstrate that IMD-AD empirically improves detection performance over several state-of-the-art baselines while providing interpretable decision diagnostics.
Figures & tables
Fig. 1: Training framework of Deep SVDD and IMD-AD, respectively. Green points represent normal samples, and red points represent abnormal samples. R and c represent the radius and center of the hypersphere, respectively. ρ represents the margin between abnormal samples and the surface of the hypersphere.
Datasets
#Classes
Sample size
Dimensions
Hidden layers
MNINST
10
60000 (train) + 10000 (test)
28*28
CNN × 2+FC × 3
Fashion MNIST
10
60000 (train) + 10000 (test)
28*28
CNN × 2+FC × 3
CIFAR-10
10
50000 (train) + 10000 (test)
32*32
CNN × 3+FC × 3
ON
4
1060
21
FC × 3
Card
10
2126
21
FC × 3
BC
2
569
30
FC × 3
TABLE I: Overview of Datasets and Corresponding Network Architecture.
Methods
MNIST
IF
KDE
OCSVM
SVDD
SSLM
AE
Deep SVDD
DROCC
IMD-AD
0
90.33
96.28
99.01
90.39
93.88
97.47
98.00
100.00
99.86
1
97.46
92.54
99.56
98.34
98.61
96.93
99.70
99.96
99.93
2
78.96
85.56
95.78
53.33
85.49
80.06
91.70
100.00
99.66
3
82.12
87.17
93.96
72.44
83.67
86.94
91.90
100.00
99.66
4
80.35
82.34
95.79
84.50
89.04
83.73
94.90
100.00
99.90
TABLE II: AUC (%) OF NINE METHOD ON THREE IMAGE DATASETS.
Datasets
Class
IF
KDE
OCSVM
SVDD
SSLM
AE
Deep SVDD
DROCC
IMD-AD
NB-No Block
79.89 ± 3.21
79.09 ± 3.36
71.82 ± 2.36
57.39 ± 3.00
81.81 ± 2.24
79.40 ± 1.94
51.26 ± 7.49
74.83 ± 0.75
88.86 ± 5.35
Block
88.90 ± 4.55
95.79 ± 0.89
93.49 ± 1.46
92.11 ± 1.23
99.43 ± 0.33
80.46 ± 1.71
76.12 ± 14.06
86.76 ± 0.69
99.45 ± 0.53
ON
No Block
92.90 ± 4.42
97.86 ± 0.59
96.73 ± 3.59
95.65 ± 1.83
99.96 ± 0.05
86.74 ± 4.46
84.14 ± 7.96
97.97 ± 1.64
99.92 ± 0.15
NB-Wait
80.62 ± 3.48
84.90 ± 3.64
83.23 ± 3.99
55.40 ± 3.59
76.77 ± 5.73
83.75 ± 2.13
56.56 ± 10.99
82.36 ± 0.47
89.00 ± 2.93
avg.
85.58 ± 6.37
89.41 ± 8.92
86.32 ± 11.25
75.14 ± 21.71
89.49 ± 11.96
82.59 ± 3.33
67.02 ± 15.64
85.48 ± 0.89
94.31 ± 6.21
Rank
5
3
4
8
2
7
9
6
1
TABLE III: Average AUC (%) with StdDevs (5 Seeds) per Method on Three Tabular Datasets.
Dataset Type
IF
KDE
OCSVM
SVDD
SSLM
AE
Deep SVDD
DROCC
Image Datasets
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0010
Tabular Datasets
0.0001
0.0001
0.0001
0.0001
0.0237
0.0001
0.0001
0.0003
All Datasets
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
TABLE IV: p -values of the Friedman test with post-hoc Wilcoxon signed-rank test for comparisons versus IMD-AD across different dataset types.
Fig. 2: Critical Difference diagrams from Friedman test with Nemenyi posthoc test ( α=0.05 ).
Fig. 3: The visualization of IMD-AD on Spiral and Moon Datasets. (a) (c) (e) (g) display the scatter plots on original data. (b) (d) (f) (h) show the extracted samples and the corresponding detection boundaries of IMD-AD.
Fig. 4: Performance curves of IMD-AD with epochs on Spiral and Moon datasets.
Fig. 5: Model classification results on MNIST with normal class 0 over training epochs.
Fig. 6: MNIST heatmap visualization comparing normal and abnormal samples for class 0.
Fig. 7: Ratio of outliers with the change of the hyperparameters on the MNIST dataset. The horizontal axis represents the theoretical upper bound determined by the model hyperparameters— (ν+1)ν1 for normal data and νν2 for abnormal data, while the vertical axis reports the empirical outlier ratio under the same settings. In each subfigure, the solid red line depicts the continuous theoretical limit. Red “ × ” markers denote discrete values of that limit. Blue “ ⋅ ” represent experimental observations.
Fig. 8: The density of squared distance between training samples and the hypersphere center c in representation space of MNINST dataset. Subfigure (a) shows the distributions at 1st epoch, while subfigure (b) corresponds to the converged distributions at 100th epoch.
Fig. 9: AUC of ablation experiments on the CIFAR-10 dataset.
Visual anomaly detection requires adaptive representations and reliable decision boundaries, particularly when anomalous training samples are scarce and class distributions are highly imbalanced. Classical kernel-based methods yield principled geometric decision regions but typically operate on fixed features, while deep detectors learn task-specific representations but often fail to provide an explicit margin-aware kernel boundary. In this study, we propose DLM-SVDD, a deep large-margin novelty-detection framework that jointly learns convolutional features and an explicit kernel-based decision boundary. By drawing on the large-margin ℓp-Support Vector Data Description (ℓp-SVDD) approach, the proposed method performs explicit margin maximization and nonlinear slack penalization while adapting the representation to the target task. To train the proposed model, we present an optimization scheme that alternates between a Frank--Wolfe--based update of the convex dual boundary and a CNN update step operating on a smooth margin-violation loss induced by the recovered boundary. To improve scalability, we analyze the efficiency--accuracy trade-offs for different kernel approximation strategies, deriving practical propositions for large-scale anomaly detection. Extensive experiments on multiple standard benchmarks show consistent performance improvements over the baseline and strong overall performance compared with state-of-the-art methods while illustrating that the proposed joint representation--boundary learning scheme remains effective under severe imbalanced class distributions.
Multi-class open-set anomaly detection requires a model to characterize the normal acceptance domain formed by multiple heterogeneous subdistributions using only class-labeled samples from known normal classes, and to identify previously unseen anomalies at test time. Existing single-hypersphere methods cannot explicitly represent class-specific locations and acceptance ranges, while current multi-hypersphere or multi-class approaches do not fully integrate inter-class boundary constraints, learnable acceptance ranges, and interpretable decisions. To address these limitations, we propose Interpretable Multi-Hypersphere Deep Anomaly Detection (IMHD-AD). IMHD-AD constructs an independent hypersphere for each known normal class in a shared feature space. With target-inside and non-target-outside constraints, IMHD-AD embeds the class-specific hypersphere centers and radii directly into the final network layer and jointly optimizes them with the shared representation. The minimum signed boundary score across hyperspheres simultaneously determines open-set acceptance or rejection and provides a faithful geometric explanation of each decision. On MNIST, Fashion-MNIST, and CIFAR-10, IMHD-AD achieves the highest AUC in 28 of 30 open-set comparisons. A two-dimensional synthetic study further shows that model architecture must balance the compactness of known normal classes against the separability of unknown anomalies.
Zhiji Yang, Fangyong Wang, Yue Li +2
School of Statistics and Mathematics, Yunnan University of Finance and Economics, Kunming, 650221, China · Beijing National Center for Applied Mathematics, Capital Normal University, Beijing, 100048, China
Deep Support Vector Data Description (Deep SVDD) has become a prominent framework for unsupervised anomaly detection by learning latent representations that compactly characterize normal data around a center. Despite its empirical success, anomaly decisions produced by Deep SVDD are typically made solely based on anomaly scores without rigorous statistical guarantees, thereby limiting their reliability in safety-critical and high-stakes applications where false positives must be strictly controlled. In this paper, we propose PADI (Post-Anomaly Detection Inference), a novel framework that equips a trained and frozen Deep SVDD detector with statistically valid inference by leveraging the Selective Inference framework. Specifically, PADI performs inference conditional on the event that a test instance is identified as anomalous by Deep SVDD, thereby enabling rigorous statistical assessment of anomaly decisions. Based on this formulation, we derive valid selective p-values that quantify the statistical significance of the detected anomaly. Using these p-values, we theoretically establish control of the false positive rate (FPR) at a user-specified significance level α (e.g., α=0.05). Furthermore, we extend the proposed framework to Deep Semi-Supervised Anomaly Detection (Deep SAD), providing a principled approach for statistically reliable inference in semi-supervised anomaly detection settings. Extensive experiments on both synthetic and real-world benchmark datasets robustly support the theoretical findings. The results demonstrate that PADI consistently achieves proper FPR control while attaining superior true positive rates compared with existing approaches.
Cao Le Cong Thanh, Dang Quang Vinh, Vo Nguyen Le Duy
University of Information Technology, Ho Chi Minh City, Vietnam · Vietnam National University, Ho Chi Minh City, Vietnam