The closeness tester by flattening #
Testing whether two unknown distributions p, q on n points are equal or at statistical distance
at least ε takes Θ(n^{2/3} ε^{-4/3} + √n ε^{-2}) samples [Chan–Diakonikolas–Valiant–Valiant]
[CDVV14]. This file proves the upper bound with explicit constants by
the flattening reduction of Diakonikolas–Kane, Proposition 2.10
(numbering of arXiv:1601.05557v1): split both distributions along the occurrences of a first batch
of samples, which makes both of their collision probabilities small
(CslibFrontier.Probability.Split), then run the ℓ₂ closeness tester closenessTester on the
split
distributions.
closenessFlatteningTester m k ε draws m + k samples x, y of each distribution. The first m
samples x₁, y₁ of each fix the counts c a = N_a(x₁) + N_a(y₁) (flatteningCount), so that
∑ c = 2m and the split domain Σ a, Fin (c a + 1) has n + 2m points. The other k samples of
each are passed independently through the split kernel and tested by
closenessTester k (2 ε / √(n + 2m)) (splitClosenessTester).
- Conditioned on
x₁, y₁, the tester accepts with the probability that theℓ₂tester accepts the split distributions (acceptProb₂_closenessFlatteningTester); splitting preserves statistical distance, and Cauchy–Schwarz onn + 2mpoints turns statistical distanceεinto squaredℓ₂distance4 ε² / (n + 2m). - The collision probability of
split p cis at most that of the split alongx₁alone, which has expectation at most1 / (m + 1); likewise forqandy₁. Markov's inequality at the level16 / (m + 1)costs probability1 / 16for each. - On the good event, the
ℓ₂tester withb = 16 / (m + 1)and errorδ = 5 / 24needs36 √b ≤ (k - 1) (4 ε² / (n + 2m)) δ, which is864 (n + 2m) ≤ 5 (k - 1) ε² √(m + 1). The total error is then at most5 / 24 + 1 / 8 = 1 / 3(isClosenessTester_closenessFlatteningTester).
Taking m = ⌈t⌉ for t = min(n, n^{2/3} ε^{-4/3}) gives
m + k ≤ 520 max(n^{2/3} ε^{-4/3}, √n ε^{-2}) + 3
(exists_isClosenessTester_closenessFlatteningTester).
The tester deviates from Diakonikolas–Kane, Proposition 2.10 in two ways,
both to stay within the fixed-sample model of acceptProb₂. It takes a fixed number m of
flattening samples instead of a Poisson number. It also flattens with samples of both p and q
rather than of q alone, so that both split collision probabilities are small. This replaces
Diakonikolas–Kane, Lemma 2.3, which needs only one of the two norms to be
small but estimates both norms first. Statistical distance dist is half the ℓ₁ distance, so
proximity ε here is ‖p - q‖₁ ≥ 2 ε in the notation of the paper.
Main definitions #
Cslib.DistributionTesting.flatteningCount: the split counts from both flattening samples.Cslib.DistributionTesting.splitClosenessTester: theℓ₂closeness tester on split samples.Cslib.DistributionTesting.closenessFlatteningTester: the closeness tester by flattening.
Main results #
Cslib.DistributionTesting.acceptProb₂_closenessFlatteningTester: the acceptance probability as an average over the flattening samples.Cslib.DistributionTesting.isClosenessTester_closenessFlatteningTester: the tester is a closeness tester once864 (n + 2m) ≤ 5 (k - 1) ε² √(m + 1).Cslib.DistributionTesting.isClosenessTester_closenessFlatteningTester_ceil: the parametersm = ⌈t⌉,k = ⌈2592 n / (5 ε² √t)⌉ + 1for any0 < t ≤ n.Cslib.DistributionTesting.exists_isClosenessTester_closenessFlatteningTester: the sample complexityO(n^{2/3} ε^{-4/3} + √n ε^{-2}).
References #
The flattening counts: the number of occurrences of a in the flattening samples x and y
together.
Unfolding lemma for flatteningCount.
The flattening counts add up to 2 m.
Unfolding lemma for flatteningProximity.
The split tester accepts p, q with the probability that the ℓ₂ tester accepts the split
distributions.
The closeness tester by flattening. Of the m + k samples of each distribution, the first
m of both fix the split counts, and the other k of each are split and tested by the ℓ₂
closeness tester with proximity 2 ε / √(n + 2m).
Unfolding lemma for closenessFlatteningTester.
The acceptance probability of the flattening tester averages, over the flattening samples
x₁, y₁, the acceptance probability of the ℓ₂ tester on the distributions split along x₁, y₁.
The closeness tester by flattening, a fixed-sample, two-sided variant of
Diakonikolas–Kane, Proposition 2.10: on a domain of size n, with m
flattening samples and k testing samples of each distribution, closenessFlatteningTester m k ε
is a closeness tester with proximity ε whenever 0 < ε and
864 (n + 2m) ≤ 5 (k - 1) ε² √(m + 1).
Choosing the parameters. For any real flattening budget 0 < t ≤ n, the flattening tester
with m = ⌈t⌉ and k = ⌈2592 n / (5 ε² √t)⌉ + 1 is a closeness tester with proximity ε.
Sample complexity of closeness testing [Chan–Diakonikolas–Valiant–Valiant]
[CDVV14]: on a nonempty domain of size n, for every 0 < ε there is
a closeness tester with proximity ε using m + k ≤ 520 max(n^{2/3} ε^{-4/3}, √n ε^{-2}) + 3
samples of each distribution, namely the flattening tester with m = ⌈min(n, n^{2/3} ε^{-4/3})⌉.