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.
Figures & tables
Figure 1: Overview of the proposed PADI method. A trained and frozen Deep SVDD model first maps test instances into the latent space and selects anomalies whose distance-based anomaly scores exceed a fixed threshold. For each selected anomaly, PADI performs SI conditional on the anomaly-selection event induced by the Deep SVDD detector. Using independent normal reference samples, PADI computes a selective p -value that quantifies the statistical significance of the detected anomaly while accounting for the selection event. The right panel illustrates how PADI differs from conventional inference: unlike naive p -values that ignore the anomaly-selection process, PADI provides statistically valid inference for detected anomalies.
Figure 2: Geometric illustration of the truncation region Z on the 1D line parametrized by z . The final region is constructed through four steps: (1) Zregion (blue) identifies the intervals where the line intersects the affine regions P1,…,PK . (2) Zscore (orange) defines the intervals where the quadratic anomaly score exceeds the threshold τ , computed independently per region. (3) Zsign (green) enforces the global sign-pattern constraint required to linearize the ℓ1 -norm discrepancy. (4) The final truncation region Z (red) is the intersection of the sign constraint with the union of region-specific valid scores. The observed test sample zobs lies within this final valid set.
Figure 3: GPU-based parallelization of PADI for convolutional Deep SVDD encoders. Before the line-search computation, the frozen CNN parameters, the input data X,A,B , and the current feasible interval are copied to GPU memory. The forward propagation is performed by custom Numba-CUDA kernels for Conv2D , BatchNorm , SILeakyReLU , SIMaxPool , and the final fully connected layer. The Conv2D , BatchNorm , and fully connected kernels propagate the forward values and affine coefficients X,A,B . In addition, the SILeakyReLU and SIMaxPool kernels compute local interval constraints induced by the LeakyReLU branches and max-pooling indices. These local constraints are combined on the GPU to update the feasible interval. The final transformed data X(L),A(L),B(L) and the final interval are then returned to the host.
Figure 4: Results on synthetic data.
Figure 5: Runtime comparison between the proposed Numba-CUDA implementation and the PyTorch-based implementation for CNN-based PADI.
Figure 6: Results on real tabular datasets. Left: empirical FPR of PADI, OC, and Naive. Right: empirical TPR of the statistically valid methods. PADI achieves stronger TPR than OC while preserving FPR control.
Figure 7: Results on real image data from the MVTec AD dataset. Left: empirical FPR of PADI, OC, and Naive across five classes. Right: empirical TPR of the statistically valid methods. PADI maintains FPR control while achieving higher TPR than OC.
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 8: Results on synthetic data for the extension to Deep SAD.
Figure 9: Results on real tabular datasets for the extension to Deep SAD. Left: empirical FPR of PADI, OC, and Naive. Right: empirical TPR of the statistically valid methods. PADI consistently achieves stronger TPR than OC while preserving FPR control.
Figure 10: Results on real image data from the MVTec AD dataset for the extension to Deep SAD. Left: empirical FPR of PADI, OC, and Naive across five classes. Right: empirical TPR of the statistically valid methods. PADI empirically maintains FPR close to the significance level while achieving higher TPR than OC.
Figure 11: Empirical FPR of PADI under non-Gaussian data distributions.
Figure 12: Effect of the reference set size on the empirical FPR and TPR.
Figure 13: Effect of the data dimension on the empirical FPR.
Figure 14: Additional evaluation on synthetic data for all competing methods.
4 blocks
5 blocks
6 blocks
7 blocks
Phase I
0.01081
0.01102
0.01151
0.01142
Phase II
9.46515
12.71300
24.60653
45.99283
Phase III
0.24853
0.16548
0.19514
0.15108
Appendix
Table 1: Runtime breakdown (in seconds) of the three phases in Algorithm 1 using the proposed Numba-CUDA implementation.
Stage
Runtime (s)
Deep SVDD training
615.34
Deep SVDD inference
0.9007
PADI
9.3698
Appendix
Table 2: Runtime Breakdown: Training, Inference, and the Proposed PADI Method
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.
Zhiji Yang, Mei Huang, Xinyu Li +3
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
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.
Semi-supervised anomaly detection, which aims to improve the anomaly detection performance by using a small amount of labeled anomaly data in addition to unlabeled data, has attracted attention. Existing semi-supervised approaches assume that most unlabeled data are normal, and train anomaly detectors by minimizing the anomaly scores for the unlabeled data while maximizing those for the labeled anomaly data. However, in practice, the unlabeled data are often contaminated with anomalies. This weakens the effect of maximizing the anomaly scores for anomalies, and prevents us from improving the detection performance. To solve this, we propose the deep positive-unlabeled anomaly detection framework, which integrates positive-unlabeled learning with deep anomaly detection models such as autoencoders and deep support vector data descriptions. Our approach enables the approximation of anomaly scores for normal data using the unlabeled data and the labeled anomaly data. Therefore, without labeled normal data, our approach can train anomaly detectors by minimizing the anomaly scores for normal data while maximizing those for the labeled anomaly data. We also provide a theoretical analysis establishing a generalization error bound for the proposed objective, guaranteeing that the empirical minimizer converges asymptotically to the ideal minimizer. Our approach achieves better detection performance than existing approaches on various datasets.