Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test

Denis Moreira dos Reis, Peter A. Flach, Stan Matwin, Gustavo E. A. P. A. BatistaKDD 2016

Abstract

Detecting "concept drift" in data streams typically requires a constant flow of expensive ground-truth labels. This paper introduces the Incremental Kolmogorov-Smirnov (IKS) test, a high-speed, unsupervised method that detects distribution changes in raw data features. By leveraging a specialized Treap data structure, the authors reduce the computational cost of the KS test from $O(N \log N)$ to $O(\log N)$ for updates. This optimization makes real-time drift detection viable for high-velocity streams without the immediate need for labels.

Introduction

In dynamic data environments—such as sensor feeds, financial markets, or user logs—the underlying patterns often change over time, a phenomenon known as concept drift. If a machine learning model fails to adapt to these changes, its predictive accuracy inevitably declines.

The primary challenge in drift detection is the "catch-22" of label dependency: most existing methods rely on monitoring a model's error rate, which requires immediate access to "true labels." In practice, labels are often delayed or expensive to obtain. This research addresses the need for unsupervised drift detection by monitoring changes in the input data distribution itself, ensuring the process is efficient enough to handle fast-moving data streams.

Methodology: The Incremental KS Test

The core contribution of this work is the Incremental Kolmogorov-Smirnov (IKS) algorithm. While the standard Kolmogorov-Smirnov (KS) test is a robust non-parametric method for comparing distributions, its $O(N \log N)$ complexity makes it a bottleneck for streaming applications.

Innovation via the Treap

To achieve high-speed updates, the authors implement the KS test using a Treap—a randomized binary search tree that also maintains heap properties. This structure provides several advantages:

  • Efficient Maintenance: The Treap keeps data observations sorted, allowing for $O(\log N)$ insertions and removals.
  • Lazy Propagation: By utilizing bulk operations (minimum, maximum, and "increase-by") with lazy updates, the algorithm maintains the cumulative distribution functions (CDFs) of two samples dynamically.
  • Constant Time Testing: Once the Treap is updated, the KS test statistic ($D$) can be calculated in $O(1)$ time.

The system operates by maintaining two windows: a reference set (representing the training data) and a current set (a sliding window of recent observations). When the IKS test identifies a significant statistical difference between these sets, a drift signal is triggered.

Experimental Evaluation

The authors evaluated the IKS approach across six real-world datasets featuring various types of drift:

  1. Arabic: Audio features of spoken digits (alternating voices).
  2. Posture: Sensor data for body movements.
  3. Bike: Hourly rental counts exhibiting seasonal drift.
  4. Keystroke: Typing patterns across different users.
  5. Insects: Laser sensor data for flying insects.
  6. Abrupt Insects: Modified insect data with sudden artificial shifts.

Results: Performance and Efficiency

The IKS method demonstrated significant improvements in both computational speed and label efficiency.

Computational Speedup

Benchmarks revealed that for 5,000 observations, IKS was one order of magnitude faster than an optimized linear version and two orders of magnitude faster than the standard KS test. This efficiency allows the test to be run after every new observation, providing near-instantaneous detection.

Accumulated processing time for Standard, Optimized, and Incremental KS tests as sample size increases.

As shown in the performance scaling, the Incremental KS maintains a nearly flat growth curve compared to the exponential-like growth of the standard and optimized versions as sample sizes increase.

Processing time relative to sliding window size for the three KS test variants.

Label Savings and Accuracy

By adopting a "Model Replacement" strategy—where labels are only requested when IKS detects a drift—the system achieved accuracies comparable to a "Topline" model (which uses all labels). Crucially, this was achieved while requesting only 42% to 47% of the total labels, representing a massive reduction in human expert costs.

Conclusion

The Incremental Kolmogorov-Smirnov test provides a scalable, unsupervised solution for drift detection. While currently limited to univariate feature monitoring, its efficiency enables frequent testing in high-velocity streams. Future work will explore multivariate extensions and the use of model ensembles to handle recurrent concepts like seasonality.

Summary updated

BibTeX
@inproceedings{reis2016fast,
  author = {Denis Moreira dos Reis and Peter A. Flach and Stan Matwin and Gustavo E. A. P. A. Batista},
  title = {{Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2016},
  doi = {10.1145/2939672.2939836},
}
Figure