Streaming Algorithms for Support-Aware Histograms

Justin Y. Chen, Piotr Indyk, Tal Wagner

Introduction

Histograms—piece-wise constant approximations—are a fundamental tool for summarizing data distributions, widely used in applications ranging from database query optimization to density estimation. However, traditional methods for constructing histograms often struggle when dealing with highly sparse data. This paper introduces support-aware histograms, a novel approach to data summarization that ignores errors in empty regions of the domain. By focusing exclusively on where data actually exists, the authors develop streaming algorithms that are exponentially more memory-efficient than traditional methods for sparse datasets.

The Flaw in Traditional Histograms

Traditionally, the quality of a histogram is measured using an $L_p$ norm, which calculates the difference between the histogram and the true distribution across the entire domain. The authors argue that this "support-oblivious" approach is fundamentally flawed for sparse data.

Consider a scenario where data only occupies a tiny fraction of a massive domain, such as specific active IP addresses within the vast 32-bit IPv4 space. A traditional histogram might waste its allocated pieces trying to approximate the zeros in the empty gaps. Worse, a flat-line approximation might incur massive error simply because it fails to perfectly capture those gaps.

A support-oblivious histogram (red) fails to capture the structure of sparse data, whereas a support-aware histogram (blue) fits the data perfectly by ignoring empty space.

To resolve this, the paper proposes support-aware error: measuring the difference only over the "support" of the distribution—the specific set of items that actually appeared in the data stream.

Streaming Algorithms: The Power of a Second Pass

The authors tackle the problem within the strict turnstile streaming model, where data elements can be both inserted and deleted over time. Their goal is to provide additive error guarantees ($\epsilon$) for $k$-piece histograms. They present two primary algorithms:

  1. 1-Pass Algorithm: This approach uses a combination of $L_1$ heavy hitter tracking and uniform sampling. It identifies high-frequency items and approximates the rest of the support using samples. The space complexity scales with $O(\sqrt{n})$, where $n$ is the domain size.
  2. 2-Pass Algorithm: By allowing a second look at the data, the authors achieve a massive breakthrough in efficiency, reducing the space requirement to $\text{polylog}(n)$.
  3. Pass 1: Uses "Hierarchical Heavy Hitters" to partition the domain into a small number of heavy singleton elements and "light" contiguous intervals.
  4. Pass 2: Exactly counts the heavy elements and uses $L_0$ sampling to find the median mass for each light interval.

The authors also provide theoretical lower bounds using communication complexity, proving that their $\sqrt{n}$ space for one pass and $\text{polylog}(n)$ space for two passes are essentially optimal. Furthermore, they prove that achieving a multiplicative error guarantee requires $\Omega(n)$ space, justifying their focus on additive error.

Empirical Results

The algorithms were evaluated on four real-world datasets representing different types of sparsity and scale: NYC Taxi pickup times, CAIDA Internet traffic destination IP prefixes, word prefix frequencies in War & Peace, and latitudes of McDonald's locations.

The most striking finding is the empirical validation of the "exponential gap" in space complexity between the 1-pass and 2-pass algorithms. In empirical tests, both proposed algorithms significantly outperformed standard baselines. On the highly sparse CAIDA dataset, traditional "support-oblivious" baselines failed to provide any non-trivial approximation, while the new support-aware algorithms converged quickly toward low error as the space budget increased.

Comparison of support-aware L1 error on the CAIDA dataset. The proposed streaming algorithms (One pass and Two pass) drastically outperform the fixed baselines.

Overall, on datasets like CAIDA and War & Peace, the proposed methods achieved up to 3x lower support-aware error for the exact same memory budget compared to traditional approaches.

Limitations and Future Work

While highly efficient, the proposed algorithms are "bi-criterion," meaning the resulting histogram might output more than the requested $k$ pieces, though the total number of pieces remains strictly bounded by the algorithm's small space budget.

Additionally, the current work focuses primarily on $L_1$ error guarantees. Extending these support-aware guarantees to $L_2$ or other $L_p$ norms remains an open challenge. Finally, future research could explore support-aware approximations using piece-wise linear or polynomial functions, moving beyond the piece-wise constant limitations of standard histograms.

Summary updated

BibTeX
@inproceedings{chen2022streaming,
  author = {Justin Y. Chen and Piotr Indyk and Tal Wagner},
  title = {{Streaming Algorithms for Support-Aware Histograms}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=AFhDRslpyg3},
}
Figure