Structure-Aware Sampling: Flexible and Accurate Summarization

Edith Cohen, Graham Cormode, Nick G. Duffield

Abstract

This paper introduces structure-aware sampling, a framework that bridges the gap between flexible random sampling and high-accuracy dedicated summaries like wavelets. By exploiting inherent data hierarchies or orders through probabilistic aggregation, the proposed method creates unbiased summaries that are 2-3x more accurate for range queries than traditional sampling while remaining flexible for ad-hoc analysis.

Introduction

In large-scale data analysis, querying full archives is often computationally prohibitive, necessitating the use of summaries. Historically, analysts have faced a trade-off between two paradigms:

  1. Random Sampling: Methods like VAROPT are flexible and unbiased but "structure-oblivious," treating data points as independent. This leads to mediocre accuracy for range queries (e.g., subnets in network traffic) because the relationships between keys are ignored.
  2. Dedicated Summaries: Wavelets and histograms are highly accurate for range queries but rigid. They often fail to provide representative samples, are slow to build in high dimensions, and lose accuracy if queries do not align with their internal structures.

This paper proposes "structure-aware sampling" to achieve the best of both worlds: the flexibility of unbiased sampling with the precision of dedicated summaries.

Methods: Probabilistic Aggregation

The core innovation is a framework called Probabilistic Aggregation. The algorithm starts with inclusion probabilities for every item and iteratively performs "pair aggregation." This step adjusts the probabilities of a pair $(i, j)$ such that at least one is either included (1) or excluded (0) from the sample, while preserving the expected sum.

Structure-Aware Selection

The effectiveness of the summary depends on the pairing strategy. While traditional sampling pairs items randomly, structure-aware sampling selects pairs that are "close" within the data's inherent structure:

  • Hierarchies: Items sharing the lowest common ancestor (LCA) are paired.
  • Ordered Sets: Adjacent items in a linear order are paired.
  • Multi-Dimensional Data: KD-trees partition the space into cells, and aggregation occurs within these cells.
Hierarchical structure-aware selection process

By aggregating locally, the algorithm ensures that the actual number of sampled items in any range remains close to the mathematical expectation, effectively minimizing "discrepancy." For massive datasets, a two-pass streaming algorithm is employed: the first pass builds a partition (like a KD-tree), and the second pass performs structured aggregation.

Evaluation and Results

The methods were evaluated using real-world network flow records (196,000 records) and technical ticket data (500,000 records).

Key Findings

  • Superior Accuracy: Structure-aware sampling was 2 to 3 times more accurate than standard structure-oblivious sampling (VAROPT) for equivalent summary sizes.
  • Outperforming Specialists: The method outperformed deterministic summaries like q-digest by one to two orders of magnitude and matched or exceeded the performance of Haar Wavelets, which are significantly more complex to implement.
  • Scalability: Unlike high-dimensional wavelets that can take hours to build, structure-aware sampling requires only two linear passes over the data.
Performance comparison on network data across space, query weight, and range counts

Conclusion

Structure-aware sampling provides a powerful alternative to traditional summarization techniques. By forcing sample counts to stay near expectations at every level of a hierarchy, it strictly bounds discrepancy. While it currently requires two passes for optimal accuracy and faces challenges in extremely high dimensions, it offers a robust, representative, and highly accurate tool for modern data analysis.

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