Distance queries from sampled data: accurate and efficient

Edith Cohen

Introduction

In modern data analysis, comparing massive datasets—such as network traffic logs or large-scale text corpora—is a critical task. Distance metrics like $L_1$ (Manhattan) and $L_2$ (Euclidean) are commonly used to quantify these differences. However, as datasets scale into the petabyte range, exact distance calculations become computationally impossible.

While random sampling is the standard approach to handle such scale, traditional estimators like the Horvitz-Thompson (HT) estimator often fail. HT estimators work by scaling sampled values by their inclusion probabilities. However, distance estimation depends on the difference between values across datasets. If a specific key (e.g., an IP address) is prominent in one dataset but absent in another, independent sampling may fail to capture the "zero" value, leading to significant estimation errors.

Methodology

This paper addresses these challenges by focusing on weighted sampling schemes, specifically Poisson Probability Proportional to Size (PPS) and Priority (bottom-$k$) sampling. These methods are designed to prioritize "heavy hitters," the most significant data points in a set.

Coordinated Sampling

A key contribution of this work is the emphasis on Coordinated Sampling (shared-seed sampling). By using a consistent random hash function to select keys across different datasets, the samples become "aligned." This alignment ensures that if a key is sampled in one dataset, it is more likely to be sampled in the other, allowing the estimator to directly observe the difference.

Comparison of independent and coordinated sampling strategies for Poisson and Priority sampling schemes.

Optimal Estimators

The author derives three specialized estimators tailored for $L_p$ distance queries:

  1. The $L^*$ Estimator: The recommended default. It is unique, symmetric, and monotone, ensuring that estimates do not fluctuate erratically as more data is added. It is also admissible, meaning it is Pareto optimal regarding variance.
  2. The $U^*$ Estimator: Designed for high-volatility scenarios where large differences between datasets are expected.
  3. The Optimally Competitive (OC) Estimator: A middle-ground approach derived through numerical optimization to minimize the worst-case variance ratio.
Visualization of the L*, U*, and OC estimators, illustrating their behavior relative to the sampling seed u.

Experimental Evaluation

The proposed estimators were tested on four diverse real-world datasets: IP packet traces (destIP), WWW activity logs (Server), surname frequencies in Google Books (Surnames), and word counts from the Official Scrabble Players Dictionary (OSPD8).

Key Results

  • Accuracy Gains: Coordinated sampling, when paired with the new estimators, outperformed independent sampling by several orders of magnitude in terms of the coefficient of variation.
  • Scalability: The methods provided reliable distance estimates even when only a tiny fraction of the data was sampled, making them suitable for real-time monitoring of massive data streams.
  • Robustness: The $L^*$ estimator proved to be "variance competitive," with its variance consistently staying within 2 to 2.5 times the theoretical minimum for any unbiased nonnegative estimator.

Conclusion

This research demonstrates that accurate distance queries on massive data require estimators specifically tailored to the $L_p$ norm and the sampling scheme. By leveraging coordinated sampling and mathematically optimal estimators like $L^*$, practitioners can achieve high-fidelity comparisons at a fraction of the computational cost. Future work may extend this monotone sampling framework to other complex statistics beyond simple distance metrics.

Summary updated

BibTeX
@inproceedings{cohen2012distance,
  author = {Edith Cohen},
  title = {{Distance queries from sampled data: accurate and efficient}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2012},
}
Figure