Abstract
The scores of distance-based outlier detection methods are difficult to interpret, making it challenging to determine a cut-off threshold between normal and outlier data points without additional context. We describe a generic transformation of distance-based outlier scores into interpretable, probabilistic estimates. The transformation is ranking-stable and increases the contrast between normal and outlier data points. Determining distance relationships between data points is necessary to identify the nearest-neighbor relationships in the data, yet, most of the computed distances are typically discarded. We show that the distances to other data points can be used to model distance probability distributions and, subsequently, use the distributions to turn distance-based outlier scores into outlier probabilities. Our experiments show that the probabilistic transformation does not impact detection performance over numerous tabular and image benchmark datasets but results in interpretable outlier scores with increased contrast between normal and outlier samples. Our work generalizes to a wide range of distance-based outlier detection methods, and because existing distance computations are used, it adds no significant computational overhead.
Introduction
In the field of anomaly detection, distance-based methods like $k$-Nearest Neighbors ($k$NN) and Local Outlier Factor (LOF) are standard tools for identifying data points that deviate from the majority. However, these algorithms suffer from a significant usability flaw: the scores they produce are often arbitrary and lack a universal scale. For instance, a score of 4.2 might indicate a severe anomaly in one dataset but a typical point in another. This lack of interpretability forces practitioners to rely on labeled data or domain expertise to set arbitrary thresholds.
Muhr et al. address this by proposing a generic, ranking-stable transformation that converts cryptic distance scores into interpretable probabilities (0 to 1). By modeling the distribution of distances already calculated by the algorithm, this method provides statistical context without adding computational overhead.
Methods
The proposed transformation treats the distances within a dataset as a random variable to estimate their probability distribution. The process involves three main steps:
- Normalization Set Selection: Instead of focusing solely on the final outlier score, the method utilizes a "normalization set"—a collection of distances between reference points already computed during the algorithm's execution.
- Distribution Fitting: A probability distribution (e.g., Normal, Exponential, or Empirical) is fitted to these distances.
- Probabilistic Transformation: The Cumulative Distribution Function (CDF) of the fitted distribution is used to map a raw distance score $s$ to a probability $p$. Because the CDF is monotonically non-decreasing, the transformation is ranking-stable, preserving the original order of anomalies.
The authors demonstrate that the choice of weighting for neighbor distances can influence the resulting scores. As shown in Figure 1, various functions such as exponential, rank-based, or linear weights can be applied to the $k$-th neighbor distances, which are then processed through the probabilistic framework to establish the statistical baseline.
Experimental Evaluation
The researchers validated their approach across a diverse range of benchmarks, including over 30 tabular datasets from the DAMI and UTSD libraries, as well as the MVTec AD image dataset for industrial inspection.
Key Results
- Performance Preservation: Across all datasets, the ROC AUC remained virtually identical to the original algorithms. The transformation enhances interpretability without compromising detection accuracy.
- Increased Contrast: The mapping significantly increases the "contrast" between normal and anomalous points. By projecting scores onto a probability curve, the distinction between a "high-normal" point and a "low-outlier" point becomes much clearer.
- Qualitative Improvements in Imaging: In image tasks, the probabilistic heatmaps suppressed background noise compared to raw distance maps, making defects like cracks or contamination stand out with higher clarity.
Conclusion
This probabilistic transformation offers a "universal translator" for distance-based outlier scores. By recycling discarded distance information into a statistical baseline, it allows for thresholding based on confidence levels (e.g., >95% probability) rather than arbitrary units. Future work will explore optimal neighborhood sizes for normalization and the application of this method to non-metric distances in high-dimensional spaces.
Summary updated