How to Estimate Change from Samples

Edith Cohen, Haim Kaplan

Abstract

Distance queries are a basic tool in data analysis. They are used for detection and localization of change for the purpose of anomaly detection, monitoring, or planning. Distance queries are particularly useful when data sets such as measurements, snapshots of a system, content, traffic matrices, and activity logs are collected repeatedly. Random sampling, which can be efficiently performed over streamed or distributed data, is an important tool for scalable data analysis. The sample constitutes an extremely flexible summary, which naturally supports domain queries and scalable estimation of statistics, which can be specified after the sample is generated. The effectiveness of a sample as a summary, however, hinges on the estimators we have. We derive novel estimators for estimating $L_p$ distance from sampled data. Our estimators apply with the most common weighted sampling schemes: Poisson Probability Proportional to Size (PPS) and its fixed sample size variants. They also apply when the samples of different data sets are independent or coordinated. Our estimators are admissible (Pareto optimal in terms of variance) and have compelling properties. We study the performance of our Manhattan and Euclidean distance ($p=1,2$) estimators on diverse datasets, demonstrating scalability and accuracy even when a small fraction of the data is sampled. Our work, for the first time, facilitates effective distance estimation over sampled data.

Introduction

In the era of "Big Data," organizations collect massive volumes of information repeatedly—ranging from daily IP traffic logs and social network activity to sensor readings and activity logs. A fundamental task in analyzing these temporal or spatial snapshots is measuring the distance between two instances. Such distance queries are essential for detecting anomalies, identifying trends, and planning system resources.

However, the sheer scale of these datasets often makes full storage and processing impossible due to bandwidth and storage constraints. While random sampling provides a standard mechanism for creating manageable summaries, it introduces significant challenges for distance estimation. Traditional estimators, such as the Horvitz-Thompson estimator, are designed for estimating sums but fail when applied to distances. This failure stems from the fact that a distance calculation depends on the values of a key in both datasets. If a key is present in one dataset but not sampled in the other, the resulting "missing information" leads to biased or highly inaccurate estimates.

Sampling Strategies: Independent vs. Coordinated

The effectiveness of distance estimation depends heavily on the sampling scheme employed. The research explores two primary scenarios:

  1. Independent Sampling: Each dataset is sampled using its own set of random coins.
  2. Coordinated Sampling (Shared-Seed): Both datasets use the same random "seeds" for sampling. This approach acts as a form of locality-sensitive hashing, ensuring that if a key is "important" enough to be sampled in one instance, it is significantly more likely to be sampled in the other.
Comparison of independent and coordinated sampling schemes for Poisson and Priority sampling.

As illustrated in Figure 3, coordination ensures that the overlap between samples is maximized for keys that are prominent in both datasets. A key insight of this research is that coordinated sampling can reduce the variance of distance estimates by orders of magnitude compared to independent sampling.

Novel Estimators: $L^*$ and $U^*$

To address the limitations of standard methods, this paper derives new, unbiased, and non-negative estimators specifically designed for $L_p$ distances over weighted sampling schemes like Poisson Probability Proportional to Size (PPS) and Priority Sampling.

The two primary novel estimators introduced are:

  • The $L^*$ Estimator: Described as the "all-rounder," $L^*$ is unique, symmetric, and monotone. Its monotonicity ensures that gathering more data always leads to a stable, predictable change in the estimate. Furthermore, it is "variance competitive," meaning its error is never more than a small constant factor away from the theoretical minimum variance for any specific data vector.
  • The $U^*$ Estimator: This estimator is specifically tailored for datasets where the differences between instances are expected to be very large.
Theoretical behavior and monotonicity of the proposed estimators across different parameter settings.

Figure 6 demonstrates the theoretical behavior of these estimators. The $L^*$ estimator's variance is proven to be at most 2 times the minimum possible variance for $L_1$ and 2.5 times for $L_2$ under coordinated sampling. This admissibility—being Pareto optimal in terms of variance—is a key contribution of the work.

Empirical Evaluation and Key Insights

The estimators were evaluated on four diverse, real-world datasets: destIP (IP destination traces), Server (WWW activity logs), Surnames (Google books corpus), and OSPD8 (dictionary word counts). The results yielded several critical insights:

  • Scalability: Accurate results are achievable even when only a small fraction of the data is sampled.
  • Dataset Specificity: The $U^*$ estimator performed exceptionally well on the destIP and Server datasets, which featured large changes between instances. Conversely, on the more stable Surnames data, the $L^*$ estimator proved superior.
  • Practicality: The paper provides closed-form expressions for these estimators, making them computationally efficient for implementation in production streaming and distributed systems.

Conclusion

This research provides the first effective framework for distance estimation over sampled data. By introducing admissible, monotone estimators and highlighting the power of coordinated sampling, the work enables scalable and accurate anomaly detection and change measurement in massive, streaming datasets. While currently focused on non-negative data, future work may extend these principles to more complex data types and similarity measures.

Summary updated

BibTeX
@inproceedings{cohen2012how,
  author = {Edith Cohen and Haim Kaplan},
  title = {{How to Estimate Change from Samples}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2012},
}
Figure