Abstract
We investigate the problem of testing whether a discrete probability distribution over an ordered domain is a histogram on a specified number of bins. One of the most common tools for the succinct approximation of data, $k$-histograms over $[n]$, are probability distributions that are piecewise constant over a set of $k$ intervals. The histogram testing problem is the following: Given samples from an unknown distribution $\mathbf{p}$ on $[n]$, we want to distinguish between the cases that $\mathbf{p}$ is a $k$-histogram versus $\varepsilon$-far from any $k$-histogram, in total variation distance. Our main result is a sample near-optimal and computationally efficient algorithm for this testing problem, and a nearly-matching (within logarithmic factors) sample complexity lower bound. Specifically, we show that the histogram testing problem has sample complexity $\widetilde \Theta (\sqrt{nk} / \varepsilon + k / \varepsilon^2 + \sqrt{n} / \varepsilon^2)$.
Introduction
In the era of big data, succinct representations are vital for managing massive datasets. Histograms are among the most fundamental tools for this purpose. A $k$-histogram is a probability distribution that is piecewise constant over $k$ intervals. This paper addresses the distribution property testing problem: given samples from an unknown distribution $p$ over a domain of size $n$, can we efficiently determine if $p$ is a $k$-histogram or if it is significantly far from any $k$-histogram in total variation distance?
The primary challenge is that the boundaries of the $k$ intervals are unknown to the algorithm. Previous research left a significant polynomial gap between upper and lower bounds for this problem. This work closes that gap with a near-optimal algorithm and matching lower bounds.
The Divide-And-Learn-And-Sieve Algorithm
The authors propose a "Testing-via-Learning" framework. Instead of a direct test, they develop an adaptive algorithm that attempts to learn the distribution under the assumption that it is a histogram.
- Equitable Partitioning: The domain is initially divided into $O(k)$ intervals with roughly equal probability mass.
- Robust Estimation: Using the "median trick," the algorithm takes multiple sample batches to estimate interval masses accurately, even in the presence of noise.
- Adaptive Sieving: This is the core innovation. The algorithm identifies "bad" intervals—those where the distribution is clearly not constant—and recursively subdivides them. Since a $k$-histogram has at most $k$ breakpoints, the number of subdivisions is bounded.
- Final Verification: After refining the partition, dynamic programming is used to check if the learned representation is close to a $k$-histogram, followed by a "tolerant" identity test.
Sample Complexity and Parameter Regimes
The main result is a sample complexity bound of $\tilde{\Theta}(\frac{\sqrt{nk}}{\epsilon} + \frac{k}{\epsilon^2} + \frac{\sqrt{n}}{\epsilon^2})$. This complexity is composed of three terms, each dominating in different regimes of the parameters $n, k,$ and $\epsilon$.
As shown in the figure above, the complexity is determined by the interplay between the domain size $n$, the number of bins $k$, and the proximity parameter $\epsilon$. For instance, when $k$ is large, the $\sqrt{nk}/\epsilon$ term becomes dominant, improving upon previous lower bounds that were stuck at $\tilde{\Omega}(\sqrt{n})$.
Lower Bound Techniques
To establish the optimality of their algorithm, the authors employ moment matching. They construct two sets of distributions—one consisting of $k$-histograms and another of distributions far from any $k$-histogram—that share identical low-degree moments. By using Chebyshev polynomials to match these moments, they prove that the distributions are information-theoretically indistinguishable unless the sample size meets the derived threshold.
Conclusion
This work provides a computationally efficient and sample-optimal solution to the histogram testing problem, resolving a long-standing discrepancy in the literature. While the results are near-optimal for one-dimensional ordered domains, extending these techniques to multi-dimensional grids remains an open challenge for future research.
Summary updated