A simple sketching algorithm for entropy estimation over streaming data

Peter Clifford, Ioana CosmaAISTATS 2013

Abstract

This paper introduces a streamlined sketching algorithm for estimating Shannon entropy in high-speed data streams. By projecting data onto a maximally skewed stable distribution at the limit $\alpha=1$, the method avoids the instability associated with previous Rényi entropy-based approximations. The resulting log-mean estimator achieves near-optimal space complexity and high statistical efficiency, even with small sketch sizes.

Introduction

In modern high-speed data environments, such as network traffic monitoring or search log analysis, calculating Shannon entropy is a critical task for anomaly detection. For instance, a sudden shift in entropy can signal a DDoS attack or port scanning. However, the sheer volume and velocity of data streams make it impossible to store counts for every distinct item. To address this, researchers use "sketches"—compact, lossy summaries of data—to estimate statistics in a single pass.

Traditionally, Shannon entropy was estimated by calculating Rényi entropy with a parameter $\alpha$ approaching 1. This "$\alpha$-calibration" approach is notoriously difficult: values too far from 1 yield poor approximations, while values too close to 1 lead to computational instability or excessive costs.

Methodology: Direct Estimation at the Limit

The authors propose a streamlined approach that bypasses the calibration problem by working directly at the limit ($\alpha=1$). The algorithm maps each incoming data point to a pseudo-random variable drawn from a maximally skewed, strictly stable distribution.

The process involves:

  1. Random Projections: Each item is projected onto the stable distribution using a "method of seeding," ensuring consistent random values for identical item types.
  2. Sketch Maintenance: A $k$-dimensional vector (the sketch) is updated via a simple weighted linear combination, supporting the "turnstile model" where items can be added or deleted.
  3. Log-Mean Estimator: The entropy estimate is extracted by exponentiating the sketch values, averaging them, and applying a logarithmic transformation.

Mathematically, the negative Shannon entropy is shown to be equivalent to the location parameter of the chosen stable distribution, allowing the entropy to be efficiently recovered from the sketch.

Performance and Efficiency

The proposed estimator is highly efficient. The authors demonstrate that for a parameter $\zeta=1$, the Asymptotic Relative Efficiency (ARE) is approximately 0.932, meaning it captures over 93% of the information available in the sketch compared to an optimal (but computationally infeasible) estimator.

Asymptotic Relative Efficiency (ARE) as a function of the parameter ζ.

Theoretical analysis shows that the algorithm requires $O(\epsilon^{-2} \log T)$ space to achieve an additive error of $\epsilon$, which is near-optimal. Furthermore, the probability of significant error decreases exponentially with the sketch size $k$.

Experimental Results

Validation using simulated data streams in R confirms these theoretical properties. The estimator performs remarkably well even with small sketch sizes. As shown in the Mean Square Error (MSE) plots, the estimator's variance closely tracks theoretical lower bounds as the sample size $k$ increases.

Mean Square Error (MSE) vs. sample size k for small (left) and large (right) sketch sizes.

The update rule's simplicity—involving only basic arithmetic—makes it ideal for hardware implementation in high-frequency networking or trading environments.

Conclusion

This sketching algorithm provides a robust and efficient solution for real-time entropy estimation. By eliminating the need for $\alpha$ parameter tuning, it offers a more stable and computationally cheaper alternative to previous methods. While currently optimized for non-negative item counts (strict-turnstile model), future work may extend its efficiency to more general update models where total counts can become negative.

Summary updated

BibTeX
@inproceedings{clifford2013simple,
  author = {Peter Clifford and Ioana Cosma},
  title = {{A simple sketching algorithm for entropy estimation over streaming data}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2013},
}
Figure