A Very Efficient Scheme for Estimating Entropy of Data Streams Using Compressed Counting

Ping LiarXiv 2008

Introduction

In the era of "Big Data," monitoring high-speed network traffic or analyzing massive databases requires efficient summary statistics. Shannon entropy is a critical metric for these tasks, serving as a vital feature for detecting network anomalies like DDoS attacks or mining web data. However, calculating entropy exactly is memory-prohibitive for vast streams, as it requires a counter for every unique item.

Researchers typically approximate entropy by calculating frequency moments ($\alpha$-th moments) and letting $\alpha$ approach 1. The standard tool for this—Symmetric Stable Random Projections—becomes incredibly inefficient as $\alpha$ gets close to 1, requiring massive sample sizes to maintain accuracy. This paper introduces a highly efficient alternative: Compressed Counting (CC).

Methodology

Compressed Counting leverages maximally-skewed stable random projections (skewness parameter $\beta = 1$) rather than the traditional symmetric ones ($\beta = 0$). The mathematical advantage is profound: as the moment $\alpha$ approaches 1, the variance of the CC estimator vanishes, whereas the variance of symmetric estimators remains high.

The authors evaluate three specific statistical estimators for CC:

  1. Geometric Mean (GM) Estimator: Useful for theoretical analysis.
  2. Harmonic Mean (HM) Estimator: More accurate than the geometric mean for $\alpha < 1$.
  3. Optimal Quantile (OQ) Estimator: The most practical choice, being computationally efficient and highly accurate even with very small sample sizes.
Asymptotic variance factor vs. $\alpha$ for various estimators. Note how the variance for CC estimators vanishes as $\alpha \to 1$, unlike the symmetric case.

Key Insights and Results

The most striking insight is the "infinite" improvement of CC over symmetric projections as $\alpha \to 1$. Because CC eliminates the variance problem in this limit, researchers can pick $\alpha$ very close to 1 (e.g., 0.99) to obtain nearly unbiased results without the noise that plagued previous methods.

Empirical Performance

The scheme was evaluated using real-world Web crawl data, testing words across a spectrum of sparsity (from common words like "THE" to rare words like "TWIST").

  • Accuracy Boost: For a fixed sample size, CC reduces the Minimum Mean Square Error (MSE) by 20 to 50 times compared to symmetric stable projections.
  • Memory Savings: To reach the same accuracy as CC with a sample size of $k=20$, symmetric methods would need up to 500 times more samples.
  • Practicality: Using the Optimal Quantile estimator with a tiny sample of just 20 units, the algorithm achieved relative errors of less than 1% on real web data.
Mean Square Error (MSE) for the 'TWIST' dataset across different estimators. CC methods (gm, hm, oq) show significantly lower MSE than the symmetric case (gm, sym) near $\alpha=1$.

Conclusion

Compressed Counting represents a significant leap in data stream processing. By thriving where previous algorithms struggled—near $\alpha = 1$—it provides a robust and memory-efficient "missing link" for estimating Shannon entropy. While currently designed for the "relaxed strict-Turnstile" model (where total counts remain non-negative), its efficiency makes it a prime candidate for real-world network monitoring and anomaly detection.

Summary updated

BibTeX
@misc{li2008very,
  author = {Ping Li},
  title = {{A Very Efficient Scheme for Estimating Entropy of Data Streams Using Compressed Counting}},
  year = {2008},
  eprint = {0808.1771},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/0808.1771},
}
Figure