# Quantifying Statistical Significance of Deep Nearest Neighbor Anomaly Detection via Selective Inference

arXiv: https://arxiv.org/abs/2502.12978 · HTML: https://mlsanity.com/paper/2502.12978/

## Key facts

- Cited by 3 papers in the map (data through 14 Oct 2026).
- Builds on 38 of its 62 references that are in the map.
- First posted on arXiv 18 Feb 2025.

## Builds on (most cited first, 30 of 38)

- [GANomaly: Semi-Supervised Anomaly Detection via Adversarial Training](https://mlsanity.com/paper/1805.06725/) (2018)
- [Diffusion Models for Medical Anomaly Detection](https://mlsanity.com/paper/2203.04306/) (2022)
- [Adversarially Learned One-Class Classifier for Novelty Detection](https://mlsanity.com/paper/1802.09088/) (2018)
- [Deep Nearest Neighbor Anomaly Detection](https://mlsanity.com/paper/2002.10445/) (2020)
- [Exact post-selection inference, with application to the lasso](https://mlsanity.com/paper/1311.6238/) (2013)
- [Optimal Inference After Model Selection](https://mlsanity.com/paper/1410.2597/) (2014)
- [Exact Post-Selection Inference for Sequential Regression Procedures](https://mlsanity.com/paper/1401.3889/) (2014)
- [Selective Inference for Hierarchical Clustering](https://mlsanity.com/paper/2012.02936/) (2020)
- [Valid Inference Corrected for Outlier Removal](https://mlsanity.com/paper/1711.10635/) (2017)
- [Testing for a Change in Mean After Changepoint Detection](https://mlsanity.com/paper/1910.04291/) (2019)
- [Computing Valid p-value for Optimal Changepoint by Selective Inference using Dynamic Programming](https://mlsanity.com/paper/2002.09132/) (2020)
- [More Powerful Conditional Selective Inference for Generalized Lasso by Parametric Programming](https://mlsanity.com/paper/2105.04920/) (2021)
- [Computing Valid p-values for Image Segmentation by Selective Inference](https://mlsanity.com/paper/1906.00629/) (2019)
- [Selective inference for k-means clustering](https://mlsanity.com/paper/2203.15267/) (2022)
- [Selective Inference for Group-Sparse Linear Models](https://mlsanity.com/paper/1607.08211/) (2016)
- [Quantifying Statistical Significance of Neural Network-based Image Segmentation by Selective Inference](https://mlsanity.com/paper/2010.01823/) (2020)
- [Valid P-Value for Deep Learning-Driven Salient Region](https://mlsanity.com/paper/2301.02437/) (2023)
- [Conditional Selective Inference for Robust Regression and Outlier Detection using Piecewise-Linear Homotopy Continuation](https://mlsanity.com/paper/2104.10840/) (2021)
- [Fast and More Powerful Selective Inference for Sparse High-order Interaction Model](https://mlsanity.com/paper/2106.04929/) (2021)
- [Applications of Generative Adversarial Networks in Anomaly Detection: A Systematic Literature Review](https://mlsanity.com/paper/2110.12076/) (2021)
- [Exact Post Model Selection Inference for Marginal Screening](https://mlsanity.com/paper/1402.5596/) (2014)
- [Image Anomalies: a Review and Synthesis of Detection Methods](https://mlsanity.com/paper/1808.02564/) (2018)
- [REB: Reducing Biases in Representation for Industrial Anomaly Detection](https://mlsanity.com/paper/2308.12577/) (2023)
- [CAD-DA: Controllable Anomaly Detection after Domain Adaptation by Statistical Inference](https://mlsanity.com/paper/2310.14608/) (2023)
- [Integrative Methods for Post-Selection Inference Under Convex Constraints](https://mlsanity.com/paper/1605.08824/) (2016)
- [Statistical Test for Anomaly Detections by Variational Auto-Encoders](https://mlsanity.com/paper/2402.03724/) (2024)
- [More Powerful and General Selective Inference for Stepwise Feature Selection using the Homotopy Continuation Approach](https://mlsanity.com/paper/2012.13545/) (2020)
- [Selective inference for the problem of regions via multiscale bootstrap](https://mlsanity.com/paper/1711.00949/) (2017)
- [si4onnx: A Python package for Selective Inference in Deep Learning Models](https://mlsanity.com/paper/2501.17415/) (2025)
- [Selective inference after cross-validation](https://mlsanity.com/paper/1511.08866/) (2015)

## Built on by (most cited first, 3 of 3)

- [Statistical Inference for Clustering-based Anomaly Detection](https://mlsanity.com/paper/2504.18633/) (2025)
- [Statistical Testing for Multiple Instance Learning via Selective Inference with Applications to Computational Pathology](https://mlsanity.com/paper/2609.31712/) (2026)
- [Post-Anomaly Detection Inference for Deep SVDD](https://mlsanity.com/paper/2609.37935/) (2026)

## Abstract (arXiv)

In real-world applications, anomaly detection (AD) often operates without access to anomalous data, necessitating semi-supervised methods that rely solely on normal data. Among these methods, deep k-nearest neighbor (deep kNN) AD stands out for its interpretability and flexibility, leveraging distance-based scoring in deep latent spaces.Despite its strong performance, deep kNN lacks a mechanism to quantify uncertainty-an essential feature for critical applications such as industrial inspection. To address this limitation, we propose a statistical framework that quantifies the significance of detected anomalies in the form of p-values, thereby enabling control over false positive rates at a user-specified significance level (e.g.,0.05). A central challenge lies in managing selection bias, which we tackle using Selective Inference-a principled method for conducting inference conditioned on data-driven selections. We evaluate our method on diverse datasets and demonstrate that it provides reliable AD well-suited for industrial use cases.
