The adaptable buffer algorithm for high quantile estimation in non-stationary data streams

Ognjen Arandjelovic, Duc-Son Pham, Svetha Venkatesh

Introduction

In real-time signal processing and computer vision—particularly in anomaly detection for CCTV surveillance—establishing a baseline for "normal" behavior is essential. This typically involves calculating high quantiles (e.g., the 95th or 99th percentile) of incoming data. However, two major hurdles exist: the massive volume of continuous data necessitates single-pass algorithms with fixed memory, and real-world data is often non-stationary, with statistical properties that shift unpredictably.

Quantile estimation in a non-stationary data stream, showing the estimate adapting to shifts in data distribution.

Existing algorithms frequently assume stationary data, leading to significant inaccuracies when distributions change. This paper introduces the Targeted Adaptable Sample algorithm, designed to track high quantiles accurately even under severe memory constraints and volatile data conditions.

Methodology: Targeted Adaptable Sampling

The core of the proposed approach is a novel theoretical insight: while the value of a quantile can jump significantly with a new data point, its index in a sorted stream changes by at most one ($0 \le \Delta k \le 1$).

The algorithm maintains a fixed-size buffer of sorted data points and "auxiliary counts" to estimate the number of historical points below each buffered value. Upon receiving a new data point:

  1. Auxiliary counts are updated.
  2. The current target quantile estimate is identified within the buffer.
  3. If the new point is near the target, it is inserted. To maintain size, the algorithm discards the extreme value (highest or lowest) furthest from the target.

This mechanism ensures the buffer remains "targeted," narrowing its focus to the values most relevant to the desired quantile while remaining flexible enough to adapt to sudden shifts.

Key Insights

  • Index Constraint: The realization that discrete data points constrain quantile movement allows for more efficient tracking than global distribution modeling.
  • Targeted Focus: Instead of approximating the entire distribution, the algorithm focuses memory strictly around the target quantile, preventing waste on irrelevant data.
  • Graceful Degradation: The centering mechanism allows the algorithm to maintain high accuracy even when the buffer size is extremely small.

Experimental Evaluation

The algorithm was tested on three large-scale, real-world data streams from a commercial video surveillance system, representing low-level motion features:

  • Stream 1: ~0.55 million points.
  • Stream 2: ~10.4 million points.
  • Stream 3: ~1.49 million points.

Results and Performance

The Targeted Adaptable Sample algorithm was compared against several baselines, including $P^2$, random sampling, and maximal entropy histograms.

  • Accuracy and Volatility: For a 0.95 quantile with a 100-bin buffer, the method achieved relative $L_1$ errors between 1.6% and 9.2%, consistently matching or exceeding baseline performance.
  • High Quantile Dominance: The algorithm's strength is most apparent at very high quantiles (e.g., 0.999). On the volatile Stream 3, it achieved a 1.6% relative error, while the previous state-of-the-art method collapsed with a 368.6% error.
  • Memory Efficiency: The algorithm maintains tight tracking of the ground truth even when the buffer is reduced to as few as 12 items, demonstrating its suitability for resource-constrained hardware.
Comparison of quantile tracking accuracy for various buffer sizes (12, 25, 100) against the ground truth.

Conclusion

The Targeted Adaptable Sample algorithm provides a robust solution for high quantile estimation in non-stationary environments. By focusing memory resources on the target quantile and leveraging the inherent constraints of quantile index movement, it offers unprecedented accuracy for high-percentile tracking in real-time systems. Future work may explore its application to median estimation, where global distribution tracking is traditionally more favored.

Summary updated

BibTeX
@inproceedings{arandjelovic2015adaptable,
  author = {Ognjen Arandjelovic and Duc-Son Pham and Svetha Venkatesh},
  title = {{The adaptable buffer algorithm for high quantile estimation in non-stationary data streams}},
  booktitle = {IJCNN},
  year = {2015},
  url = {https://openreview.net/forum?id=pJ8ExfT_wX1},
}
Figure