Introduction
Principal Component Analysis (PCA) is a cornerstone of unsupervised anomaly detection. By training a model to compress and reconstruct "normal" data, researchers can identify outliers based on high reconstruction errors. However, identifying that a data point is an anomaly is often insufficient; practitioners need to know why.
A common pitfall in explaining these anomalies is the "symptom vs. cause" problem. Because features in real-world datasets are often highly correlated, an anomaly in one feature can manifest as a large reconstruction error in a completely different, but related, feature. This paper proposes a mathematically rigorous method to localize the true source of anomalies using Shapley values derived from Probabilistic PCA (PPCA).
The Challenge: Symptoms vs. Causes
In reconstruction-based detection, the naive approach to explanation is to attribute the anomaly to the feature with the highest individual reconstruction error. This frequently leads to false conclusions. For example, in a vehicle dataset, an anomalous "weight" might cause the model to fail in reconstructing "engine size" because the two are physically linked.
To solve this, the authors turn to Shapley values, a concept from cooperative game theory that distributes a "payout" (in this case, the total reconstruction error) among "players" (the features) based on their marginal contributions.
Methodology: Leveraging Probabilistic PCA
Computing Shapley values typically requires evaluating a model's output across all possible subsets of features. This presents two major hurdles: computational intractability (retraining the model for every subset) and the "independence trap" (assuming features are statistically independent when marginalizing out missing data).
To bypass these, the authors utilize Probabilistic PCA (PPCA). PPCA defines a joint Gaussian distribution over all features, allowing for the analytical derivation of the exact conditional distribution of missing features given a known subset. This enables the calculation of expected reconstruction errors without retraining and without the flawed assumption of feature independence. The final Shapley values are then approximated using a Monte Carlo sampling method over feature permutations.
Key Results and Insights
The method was evaluated using the 2004 New Car and Truck Data with artificially injected anomalies and 10 real-world datasets from the Outlier Detection DataSets (ODDS) library.
Superior Anomaly Localization
On the artificial car dataset, where the ground truth is known, the Shapley value method significantly outperformed raw reconstruction errors:
- Hits@1: Shapley values correctly identified the anomalous feature 48.4% of the time, compared to 31.6% for raw errors.
- Hits@3: Shapley values captured the true anomaly 80.1% of the time, versus 60.5% for raw errors.
Real-World Performance
On the ODDS datasets, the correlation between raw errors and Shapley values varied. While they often aligned in simpler cases, they diverged significantly in complex datasets like Mammography or ForestCover. This divergence suggests that Shapley values capture a more theoretically rigorous measure of feature importance that raw errors miss when correlations are high.
Conclusion
By applying Shapley values to the exact conditional distributions of PPCA, this research provides a robust framework for explaining PCA-based anomalies. It moves beyond identifying symptoms and successfully localizes root causes by accounting for feature dependencies. Future work aims to extend this approach to non-linear models like Autoencoders and handle multimodal data through Mixtures of PCAs.
Summary updated