Structure-Aware Sampling: Flexible and Accurate Summarization

Edith Cohen, Graham Cormode, Nick G. Duffield

Data analysts frequently need to summarize massive datasets—such as network logs or sales records—to enable fast, approximate querying. Traditionally, this requires a choice between two paradigms: random sampling or dedicated summaries. This paper introduces Structure-Aware Sampling, a novel framework that combines the flexibility of random sampling with the high accuracy of dedicated summaries like wavelets or histograms. By employing "probabilistic aggregation," the authors create summaries that are unbiased and flexible for arbitrary queries while dramatically reducing error for range-sum queries over hierarchical or ordered data.

The Challenge of Data Summarization

Traditional summarization techniques often force a trade-off:

  1. Random Sampling (e.g., VAROPT): These methods are "structure-oblivious." They are highly flexible and unbiased, making them suitable for any data subset. However, they often exhibit high variance when answering range queries (e.g., "What was the total traffic for this IP prefix?").
  2. Dedicated Summaries (e.g., Wavelets, Histograms): These are built specifically for range queries and offer high accuracy. However, they are inflexible, do not provide representative samples, and their accuracy degrades significantly if a query does not align with their internal structure.

Structure-Aware Sampling bridges this gap by creating a summary that is technically a random sample—retaining all its mathematical advantages—but is "aware" of the underlying data structure to minimize error on common query types.

Methodology: Probabilistic Aggregation

The core innovation is a framework called Probabilistic Aggregation. The fundamental building block is the PAIR-AGGREGATE step.

The PAIR-AGGREGATE primitive for probabilistic aggregation.

Given two items with inclusion probabilities $p_i$ and $p_j$, the algorithm "merges" them. One item's probability is boosted (potentially to 1, meaning it is definitely included), while the other is reduced (potentially to 0). While standard sampling merges pairs arbitrarily, the authors show that merging pairs that are "close" in the data's structure (e.g., sharing a low-level node in a hierarchy) localizes the error.

Hierarchical structure-aware sampling example showing the aggregation of inclusion probabilities (red) across a tree structure and the resulting state transitions.

The framework adapts to various structures:

  • Hierarchies: Pairs with the lowest common ancestor are aggregated first, ensuring the number of samples in any node is nearly exact (discrepancy < 1).
  • Ordered Sets: Adjacent items are aggregated, keeping discrepancy below 2 for any interval.
  • Multi-dimensional Data: kd-trees partition the space into cells, followed by hierarchical aggregation across those cells.

Evaluation and Results

The authors evaluated their approach on real-world datasets, including IP flow records (196K pairs) and technical ticket data (500K records).

  • Superior Accuracy: On the Network dataset, structure-aware sampling was 2-3x more accurate than standard VAROPT sampling and often 1-2 orders of magnitude more accurate than deterministic tools like q-digests for the same summary size.
  • Construction Speed: The method is significantly faster to build than wavelets. In tests, building a Haar wavelet summary was four orders of magnitude slower than the sampling approach.
  • Query Performance: Since the summary is a small list of weighted items, query processing is nearly instantaneous.

Conclusion

Structure-Aware Sampling exploits the freedom of choice in sampling distributions to respect data geometry. By keeping "probability mass" localized, it ensures every neighborhood in the data receives its fair share of samples. While the current I/O efficient version requires two passes, it represents a significant step toward flexible, high-accuracy data summarization. Future work may explore more complex structures and true one-pass streaming implementations.

Summary updated

BibTeX
@article{cohen2011structure,
  author = {Edith Cohen and Graham Cormode and Nick G. Duffield},
  title = {{Structure-Aware Sampling: Flexible and Accurate Summarization}},
  journal = {Proc. VLDB Endow.},
  year = {2011},
  url = {https://openreview.net/forum?id=UbyKZsO3p8Z1},
}
Figure