Abstract
We present a novel algorithm for anomaly detection on very large datasets and data streams. The method, named EXPected Similarity Estimation (EXPoSE), is kernel-based and able to efficiently compute the similarity between new data points and the distribution of regular data. The estimator is formulated as an inner product with a reproducing kernel Hilbert space embedding and makes no assumption about the type or shape of the underlying data distribution. We show that offline (batch) learning with EXPoSE can be done in linear time and online (incremental) learning takes constant time per instance and model update. Furthermore, EXPoSE can make predictions in constant time, while it requires only constant memory. In addition, we propose different methodologies for concept drift adaptation on evolving data streams. On several real datasets we demonstrate that our approach can compete with state of the art algorithms for anomaly detection while being an order of magnitude faster than most other approaches.
Introduction
Anomaly detection—the identification of data points that deviate significantly from the norm—is a critical task in fields such as fraud detection, network security, and industrial monitoring. In the modern "Big Data" era, traditional algorithms face significant hurdles. Many classical methods, such as Kernel Density Estimation (KDE) or Local Outlier Factor (LOF), suffer from high computational complexity—often scaling quadratically ($O(n^2)$)—making them impractical for datasets with millions of points. Furthermore, real-world data often arrives in infinite streams where the underlying distribution may shift over time, a phenomenon known as concept drift.
EXPoSE (EXPected Similarity Estimation) addresses these challenges by providing a mathematically rigorous yet computationally lightweight kernel-based framework designed for both massive batch processing and high-speed streaming environments.
Methodology: Expected Similarity Estimation
The core innovation of EXPoSE lies in its use of Kernel Mean Embeddings. Rather than comparing a new query point to every individual point in a training set, EXPoSE embeds the entire distribution of "normal" data into a single point—a "mean map"—within a high-dimensional Reproducing Kernel Hilbert Space (RKHS).
The anomaly score for a new observation $z$ is calculated as the inner product (similarity) between that point's feature map $\phi(z)$ and the distribution's mean map $\mu[\mathbb{P}]$: $$\eta(z) = \langle \phi(z), \mu[\mathbb{P}] \rangle$$
To make this computationally feasible, the authors employ Random Kitchen Sinks (RKS). This technique approximates the potentially infinite-dimensional feature map by projecting data into a finite, $r$-dimensional space using random projections. This approach is particularly advantageous for streaming data because, unlike data-dependent approximations like Nyström, RKS remains robust as the data distribution evolves.
Streaming and Concept Drift
Because the model is represented as a running average of feature vectors, it can be updated incrementally in $O(1)$ time. To handle concept drift, EXPoSE utilizes two primary strategies:
- Sliding Windows: Maintaining a buffer of the most recent observations.
- Gradual Forgetting (Decay): Applying a decay factor ($\gamma$) to older observations, allowing the model to adapt dynamically to new patterns in the data stream.
Complexity and Performance Analysis
A defining feature of EXPoSE is its efficiency across training, prediction, and memory usage. As shown in the comparison below, EXPoSE maintains linear or constant complexity where many traditional methods scale poorly.
In empirical evaluations, EXPoSE demonstrated significant speed advantages. On the KDD Cup 99 dataset (approx. 1 million instances), EXPoSE completed training in just 44 seconds. In contrast, the One-Class SVM required over 6 hours, and methods like KDE failed to finish within a 48-hour window.
Key Results and Discussion
Beyond speed, EXPoSE maintains high competitive accuracy. In batch mode across 27 datasets, it achieved an average rank of 1.85, outperforming iForest (3.48) and One-Class SVM (2.90). In streaming scenarios involving both sudden and smooth concept drift, the decay-based variant ($\gamma$-EXPoSE) adapted faster and maintained higher accuracy than specialized streaming algorithms like STORM or HSTa.
The primary limitation of the method is its sensitivity to hyperparameters, specifically the kernel bandwidth ($\sigma$) and the number of random expansions ($r$). While $r$ must be sufficiently large (e.g., 20,000) for complex datasets, the memory footprint remains constant relative to the number of training samples $n$, making it ideal for resource-constrained environments.
Conclusion
EXPoSE represents a significant advancement in large-scale anomaly detection. By treating probability distributions as vectors in an RKHS and utilizing random feature approximations, it achieves a unique balance of mathematical rigor and extreme computational efficiency. Its ability to handle both massive static datasets and evolving data streams makes it a versatile tool for modern data science applications.
Summary updated