Improved histogram-based anomaly detector with the extended principal component features

Sunil Aryal, Arbind Agrahari Baniya, Kc SantosharXiv 2019

Abstract

Traditional anomaly detection methods often face a trade-off between computational efficiency and the ability to detect complex, correlation-based anomalies. This paper presents SPAD+, an enhanced version of the Simple Probabilistic Anomaly Detector (SPAD). By augmenting the original feature set with principal components, SPAD+ overcomes the "independence assumption" of standard histogram-based methods. Experimental results across 15 benchmark datasets demonstrate that SPAD+ achieves superior accuracy (average rank 1.67) and maintains high scalability, making it suitable for large-scale data applications.

Introduction

In the era of big data, the volume of records ($N$) and dimensions ($M$) makes distance-based anomaly detection algorithms like Local Outlier Factor (LOF) computationally expensive due to their $O(N^2)$ or $O(N \log N)$ complexity. Histogram-based methods, such as the Simple Probabilistic Anomaly Detector (SPAD), offer a faster alternative by assuming feature independence and calculating scores in $O(NM)$ time.

However, this independence assumption leads to a failure in detecting Type II anomalies—data points that appear normal in individual dimensions but are anomalous when feature correlations are considered. For example, a person's height and weight might both be within normal ranges individually, but their combination could be highly improbable.

Methodology

SPAD+ addresses the limitations of independence-based detection through a feature expansion strategy.

Feature Augmentation via PCA

The core innovation of SPAD+ is the inclusion of Principal Component Analysis (PCA) features alongside original attributes.

  1. Robust Histograms: The algorithm uses equal-width histograms to estimate probability mass. To mitigate the impact of outliers on binning, ranges are defined by $[\mu - 3\sigma, \mu + 3\sigma]$ rather than absolute extremes.
  2. PCA Transformation: PCA is applied to the training set to identify uncorrelated axes (Principal Components).
  3. Feature Doubling: Instead of using PCA for dimensionality reduction, SPAD+ doubles the feature space. For an input with $M$ features, the model operates on $2M$ features (original + principal components).
  4. Scoring: The anomaly score is the sum of log-probabilities across all $2M$ dimensions. A low probability mass in any dimension—original or principal component—contributes to a higher anomaly score.
Visualizing how PCA reveals Type II anomalies: (a) Input space where the anomaly (blue dot) is hidden within marginal distributions, and (b) PC space where the anomaly is clearly separated.

Computational Efficiency

Despite the added PCA step, SPAD+ remains highly efficient. The PCA eigen-decomposition is a one-time cost during training ($O(M^3)$). During the testing phase, the complexity is $O(nM)$, where $n$ is the number of test samples. This linear scaling ensures that SPAD+ can handle massive datasets where distance-based methods fail.

Comparison of time and space complexity across different anomaly detection methods.

Experimental Results

The authors evaluated SPAD+ against 15 diverse datasets spanning medical, cybersecurity, and image domains, with sizes ranging from $N=112$ to $N=141,650$.

  • Accuracy: SPAD+ achieved the best average rank (1.67) compared to LOF (2.80), Isolation Forest (3.40), and the original SPAD (3.80). It improved the Area Under the Curve (AUC) in 13 out of 15 datasets.
  • Scalability: On the Covertype dataset ($N \approx 141k$), SPAD+ was approximately 10 times faster than LOF (44s vs 438s) while delivering competitive performance.
  • Low-Variance Components: A key finding is that low-variance principal components are crucial for detection. These components represent the "constraints" of the data; anomalies often manifest as violations of these constraints.

Conclusion

SPAD+ successfully bridges the gap between the speed of histogram-based methods and the correlation-awareness of PCA. By doubling the feature space, it effectively identifies both Type I (univariate) and Type II (multivariate) anomalies. While currently limited to linear correlations, future work exploring efficient non-linear transformations could further enhance its detection capabilities for complex data manifolds.

Summary updated

Abstract

In this era of big data, databases are growing rapidly in terms of the number of records. Fast automatic detection of anomalous records in these massive databases is a challenging task. Traditional distance based anomaly detectors are not applicable in these massive datasets. Recently, a simple but extremely fast anomaly detector using one-dimensional histograms has been introduced. The anomaly score of a data instance is computed as the product of the probability mass of histograms in each dimensions where it falls into. It is shown to produce competitive results compared to many state-of-the-art methods in many datasets. Because it assumes data features are independent of each other, it results in poor detection accuracy when there is correlation between features. To address this issue, we propose to increase the feature size by adding more features based on principal components. Our results show that using the original input features together with principal components improves the detection accuracy of histogram-based anomaly detector significantly without compromising much in terms of run-time.
BibTeX
@misc{aryal2019improved,
  author = {Sunil Aryal and Arbind Agrahari Baniya and KC Santosh},
  title = {{Improved histogram-based anomaly detector with the extended principal component features}},
  year = {2019},
  eprint = {1909.12702},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.12702},
}
Figure