Independence Testing for Bounded Degree Bayesian Networks
Abstract
We study the following independence testing problem: given access to samples from a distribution P over { 0 , 1 } n , decide whether P is a product distribution or whether it is ε -far in total variation distance from any product distribution.
For arbitrary distributions, this problem requires exp( n ) samples.
We show in this work that if P has a sparse structure, then in fact only linearly many samples are required.
Specifically, if P is Markov with respect to a Bayesian network whose underlying DAG has in-degree bounded by d , then ˜Θ(2 d/ 2 · n/ε 2 ) samples are necessary and sufficient for independence testing.
Introduction
It is often convenient to model high-dimensional datasets as probability distributions.
An important reason is that the language of probability formalizes what we intuitively mean by two features of the data being independent : the marginal distributions along the two corresponding coordinates are statistically independent.
Independence is a basic probabilistic property that, when true, enables better interpretability of data as well as computationally fast inference algorithms.
In this work we study the problem of testing whether a collection of n binary random variables are mutually independent.
Independence testing is an old and foundational problem in hypothesis testing [Neyman and Pearson, 1933, Lehmann et al., 2005] and we consider it from the perspective of property testing [Rubinfeld and Sudan, 1996, Goldreich et al., 1998].
Our goal is to design a tester that accepts product distributions on n variables and rejects distributions that have statistical distance at least ε from every product distribution.
The tester gets access to i.i d. samples from the input distribution and can fail (in either case) with probability at most 1 / 3 .
The objective is to minimize the number of samples as a function of n and ε .
Previous work [Diakonikolas and Kane, 2016] shows 1 that testing independence of a distribution on { 0 , 1 } n requires 2 Ω( n ) queries which is intractable.
However, there is an aspect of this proof that is unsatisfying.
The “hard distributions”, which are shown to require many queries to distinguish from product distributions, cannot be described succinctly, as they require exponentially many bits to describe.
Thus, a natural question arises: can we test independence efficiently for distributions on { 0 , 1 } n that have a sparse description?
One of the most canonical ways to describe high-dimensional distributions is as Bayesian networks (or Bayes nets in short).
A Bayes net specifies how to generate an n -dimensional sample in an iterative way and is especially useful for modeling causal relationships.
Formally, a Bayes net on { 0 , 1 } n is given by a directed acyclic graph (DAG) G on n vertices and probability distributions p
i,π on { 0 , 1 } for all i ∈ [ n ] and all assignments π to the parents of the i ’th node in the graph G .
An n -dimensional sample is obtained by sampling the nodes in a topological order of G , where the i ’th node is sampled according to p i,π for the assignment π that is already fixed by the samples of the parent nodes of i .
The generated distribution on { 0 , 1 } n is said to be Markov with respect to G .
In this work, we consider independence testing on distributions having a sparse Bayes net description, a class of distributions naturally arising in, and with numerous applications to, machine learning [Wainwright and Jordan, 2008], robotics, natural language processing, medicine, and biological settings such as gene expression data [Friedman et al., 2000, Peng et al., 2009, Gardner et al., 2003] (where it is known that most genetic networks are actually sparse).
In these cases, one hopes to leverage that additional knowledge to test whether those sparse, local dependencies are actually present without having to pay the prohibitive exponential cost in the dimension n .
Specifically, we analyze independence testing on distributions that are promised to be Markov with respect to a
DAG of maximum in-degree d , where d ≪ n .
While the learning sample complexity, known to be ˜ O (2 d · n/ε 2 ) [Bhattacharyya et al., 2020], provides a baseline for the testing question, it is not at all obvious that this is tight, and what the correct dependence on d and even n are.
Our main result essentially settles this question, and establishes the following:
Theorem 1.1 (Informal Main Theorem) .
Suppose an unknown distribution P on { 0 , 1 } n is Markov with respect to an unspecified degree- d DAG.
The sample complexity of testing whether P is a product distribution or is at least ε -far from any product distribution is ˜Θ(2 d/ 2 · n/ε 2 ) .
In the course of proving this theorem, we additionally derive several technical results that are of independent interest, such as bounds on the moment generating function of squared binomials and an independence testing algorithm for arbitrary distributions in Hellinger distance.
Our work explicitly initiates the study of testing graphical structure in the context of property testing.
That is, instead of testing a statistical property of a distribution (as is typical in distribution property testing), we can interpret our problem as that of testing a graphical property of the underlying graph that describes the distribution.
In particular, testing independence can be viewed as testing maximum degree-0 of a distribution’s graph.
This point of view opens the door to testing many other relevant graphical properties of graphical models, e.g., maximum degree k , being a forest, being connected, etc.
Hence, by analyzing the “base case” of independence testing, we provide a necessary first step to solving other graphical testing problems.
Information-theoretic bounds for related problems were studied recently by Neykov et al.
1.1 Related Work
Distribution testing has been an active and rapidly progressing research program for the last 20+ years; see Rubinfeld [2012] and Canonne [2020] for surveys.
One of the earliest works in this history was that of Batu et al.
[2001] who studied testing independence of two random variables.
There followed a series of papers [Alon et al., 2007, Levi et al., 2013, Acharya et al., 2015], strengthening and generalizing bounds for this problem, culminating in the work of Diakonikolas and Kane [2016] who gave tight bounds for testing independence of distributions over [ n 1 ] × · · · × [ n d ] .
Hao and Li [2020] recently considered the (harder) problem of estimating the distance to the closest product distribution (i.e., tolerant testing), showing this task could, too, be performed with a sublinear sample complexity.
Though most of the focus has been on testing properties of arbitrary input distributions, it has long been recognized that distributional restrictions are needed to obtain sample complexity improvements.
For example, Rubinfeld and Servedio [2009], Adamaszek et al.
[2010] studied testing uniformity of monotone distributions on the hypercube.
Similarly, Daskalakis et al.
[2012] considered the problem of testing monotonicity of k -modal distributions.
The question of independence testing of structured high-dimensional distributions was considered in Daskalakis et al.
[2019] in the context of Ising models.
We note that while their work is in the same spirit as ours, Ising models and Bayes nets are incomparable modeling assumptions, and their results (and techniques) and ours are mostly disjoint.
Further, while the results may overlap in some special cases, the conversion between parameterizations makes them difficult to compare even in these cases (e.g., dependence on the maximum edge value parameter β for Ising models, and max-undirected-degree vs. max-in-degree).
More recently, Canonne et al.
[2020], Daskalakis and Pan [2017], Bhattacharyya et al.
[2020, 2021] have studied identity testing and closeness testing for distributions that are structured as degree- d
Bayes nets.
Our work here continues this research direction in the context of independence testing.
1.2 Our techniques
Upper bound.
The starting point of our upper bound is the (standard) observation that a distribution P over { 0 , 1 } n is far from being a product if, and only if, it is far from the product of its marginals.
By itself, this would not lead to any savings over the trivial exponential sample complexity.
However, we can combine this with a localization result due to Daskalakis and Pan [2017], which then guarantees that if the degree- d Bayes net P is at Hellinger distance ε from the product of its marginals P ′ , then there exists some vertex i ∈ [ n ] such that P i, Π i (the marginalization of P onto the set of nodes consisting of i and its d parents) is at Hellinger distance at least ε √ n from P
i, Π i .
These two facts, combined, seem to provide exactly what is needed: indeed, given access to samples from P and any fixed set of d + 1 vertices S , one can simulate easily samples from both P S and P ′ S (for the second, using d + 1 samples from P to generate one from P ′ S , as P ′ S is the product of marginals of
P S ).
A natural idea is then to iterate over all (cid:0) nd +1 (cid:1) possible subsets S of d + 1 variables and check whether P S = P ′ S for each of them using a closeness testing algorithm for arbitrary distributions over { 0 , 1 } d +1 : the overhead due to a union bound and the sampling process for P S , P ′ S adds a factor O ( d · log (cid:0) nd +1 (cid:1) )
=
O ( d 2 log n ) to the closeness testing procedure.
However, since testing closeness over { 0 , 1 } d +1 to total variation distance ε ′ has sample complexity O (2 2 d/ 3 /ε ′ 2 ) and, by the quadratic relation between Hellinger and total variation distances, we need to take ε ′ =
ε 2 n , we would then expect the overall test to result in a ˜ O (2 2 d/ 3 n 2 /ε 4 ) sample complexity – much more than what we set out for.
A first natural idea to improve upon this is to avoid the back and forth between Hellinger and total variation distance, and save on this quadratic blowup.
Namely, by using an optimal closeness testing algorithm directly for Hellinger distance [Diakonikolas and Kane, 2016], we could in the last step keep ε ′ = ε √ n (saving on this quadratic blowup), and pay only overall ˜ O (2 3 d/ 4 /ε ′ 2 ) =
˜ O (2 3 d/ 4 n/ε 2 ) .
This is better, but still falls short of our original goal.
The second idea is to forego closeness testing in the last step entirely, and instead use directly an independence testing algorithm for arbitrary distributions over { 0 , 1 } d +1 , to test if P S is indeed a product distribution for every choice of S considered.
Unfortunately, while promising, this idea suffers from a similar drawback as our very first attempt: namely, the known independence testing algorithms are all designed for testing in total variation distance (not Hellinger)!
Thus, even using an optimal TV testing algorithm for independence [Acharya et al., 2015, Diakonikolas and Kane, 2016] would still lead to this quadratic loss in the distance parameter ε ′ , and a resulting ˜ O (2 d/ 2 n 2 /ε 4 ) sample complexity.
To combine the best of our last two approaches and achieve the claimed ˜ O (2 d/ 2 n/ε 2 ) , we combine the two insights and perform, for each set S of d + 1 variables, independence testing on P S in
Hellinger distance.
In order to do so, however, we first need to design a testing algorithm for this task, as none was previously available in the literature.
Fortunately for us, we are able to design such a testing algorithm (Lemma 3.2) achieving the desired – and optimal – sample complexity.
Combining this Hellinger independence testing algorithm over { 0 , 1 } d +1 with the above outline finally leads to the ˜ O (2 d/ 2 n/ε 2 ) upper bound of Theorem 1.1.
Lower bound.
To obtain our Ω(2 d/ 2 n/ε 2 ) lower bound on testing independence of a degree- d
Bayes net, we start with the construction introduced by Canonne et al.
[2020] to prove an Ω( n/ε 2 ) sample complexity lower bound on testing uniformity of degree-1 Bayes nets.
At a high level, this construction relies on picking uniformly at random a perfect matching M of the n vertices, which defines the structure of the Bayes net; and, for each of the n/ 2 resulting edges, picking either a positive or negative correlation (with value ± ε/ √ n ) between the two vertices, again uniformly at random.
One can check relatively easily that every Bayes net P λ obtained this way, where λ encodes the matching M and the 2 n/ 2 signs, is (1) a degree- 1 Bayes net, (2) at total variation ε from the uniform distribution U .
The bulk of their analysis then lies in showing that (3) Ω( n/ε 2 ) samples are necessary to distinguish between U and such a randomly chosen P λ .
Generalizing this lower bound construction and analysis to independence testing (not just uniformity), and to degree- d (and not just degree- 1 ) Bayes nets turns out to be highly non-trivial, and is our main technical contribution.
Indeed, in view of the simpler and different Ω(2 d/ 2 √ n/ε 2 ) sample complexity lower bound for uniformity testing degree- d Bayes nets obtained in Canonne et al.
[2020] when the structure of the
Bayes net is known , 2 one is tempted to adapt the same idea to the matching construction: that is, reserve d − 1 out of the n vertices to “encode” a pointer towards one of 2 d − 1 independently chosen
P λ ’s as above (i.e., the hard instances are now uniform mixtures over 2 d − 1 independently generated degree- 1 hard instances).
The degree- 1 hard instances lead in previous work to a tighter dependence on n (linear instead of √ n ) because their Bayesian structure is unknown .
Thus, by looking at the mixture of these degree- 1 Bayes nets, one could hope to extend the analysis of that second lower bound from Canonne et al.
[2020] and get the desired Ω(2 d/ 2 n/ε 2 ) lower bound.
Unfortunately, there is a major issue with this idea: namely, if the 2 d − 1 matchings are chosen independently, then the resulting overall distribution is unlikely to be a degree- d Bayes net – instead, each vertex will have expected degree Ω(2 d ) !
(This was not an issue in the corresponding lower bound of Canonne et al.
[2020], since for them each of the 2 d components of the mixture was a degree- 0 Bayes net, i.e., a product distribution; so degrees could not “add up” across the components).
To circumvent this, we instead choose the matching M to be common to all 2 d − 1 components of the mixture and only pick the sign of their n/ 2 correlations independently; thus ensuring that every node in the resulting distribution P has degree d .
This comes at a price, however: the analysis of the Ω(2 d/ 2 √ n/ε 2 ) lower bound from Canonne et al.
[2020] crucially relied on independence across those components, and thus can no longer be extended to our case (where the 2 d − 1 distributions P λ share the same matching M , and thus we only have independence across components conditioned on M ).
Handling this requires entirely new ideas, and constitutes the core of our lower bound.
In particular, from a technical point of view this requires us to handle the moment-generating-function of squares of Binomials, as well as that of (squared) truncated Binomials.
To do so, we develop a range of results on Binomials and Multinomial distributions we believe are of independent interest.
Finally, after establishing that Ω(2 d/ 2 n/ε 2 ) samples are necessary to distinguish the resulting “mixture of trees” P from the uniform distribution U (Lemma 2.3), it remains to show that this implies our stronger statement on testing independence (not just uniformity).
To do so, we need to show that P is not only far from U , but from every product distribution: doing so is itself far from immediate, and is established in Lemma 2.4 by relating the distance from the mixture P to every product distribution to the distance between distinct components of the mixture, and lower bounding those directly by analyzing the concentration properties of each component P λ of our construction.
Preliminaries.
We use the standard asymptotic notation O ( · ) , Ω( · ) Θ( · ) , and write ˜ O ( · ) to omit polylogarithmic factors in the argument.
Throughout, we identify probability distributions over discrete sets with their probability mass functions (pmf), and further denote by U (resp., U d ) the uniform distribution on { 0 , 1 } n (resp., { 0 , 1 } d ).
We also write P ⊗ m for the m -fold product of a distribution P , that is, P ⊗ · · · ⊗ P (the distribution of a tuple of m i.i.d.
samples from P ); and [ n ] for the set { 1 , . .
. , n } .
Bayesian networks.
Given a directed acyclic graph (DAG) over n nodes, a probability distribution P over { 0 , 1 } n is said to be Markov with respect to G if P factorizes according to G ; we will also say that P has structure G .
A DAG G is said to have in-degree d , if every node has at most d parents; for convenience, we use degree- d exclusively as “in-degree d ” throughout the paper; we will denote by Π i ⊆
[ n ] the set of parents of a node i .
Finally, a distribution P over { 0 , 1 } n is a degree- d Bayes net if P is Markov w.r.t.
some degree- d DAG.
Distances between distributions.
Given two distributions P, Q over the same (discrete) domain X , the total variation distance (TV) between P and Q is defined as
[Equation]
While TV distance will be our main focus, we will also rely in our proofs on two other notions of distance between distributions: the Hellinger distance , given by d H ( P, Q ) = 1 √ 2 ∥√ P − √ Q ∥ 2 , and the chi-squared divergence , defined by d χ 2 ( P, Q ) = (cid:80) x ∈X ( P ( x ) − Q ( x )) 2 /Q ( x ) .
TV distance, squared Hellinger distance, and χ 2 divergence are all instances of f -divergences, and as such satisfy the data processing inequality; further, they are related by the following sequence of inequalities:
[Equation]
Tools from previous work.
We finally state results from the literature which we will rely upon.
Corollary 1.2 (Daskalakis and Pan [2017, Corollary 2.4]) .
Suppose P and Q are distributions on Σ n with common factorization structure
[Equation]
where we assume the nodes are topologically ordered, and Π i is the set of parents of i .
Then
[Equation]
In particular, if d 2H ( P, Q ) ⩾ ε then there exists some i
such that d 2H (cid:0) P X
i ,X Π i , Q X i ,X Π
i (cid:1) ⩾ εn
[Equation]
Lemma 1.3 (Acharya et al.
[2015, Lemma 4]) .
There exists an efficient algorithm which, given samples from a distribution P over [ n 1 ] × · · · × [ n d ] , outputs a product distribution Q over [ n 1 ] × · · · × [ n d ] such that, if P is a product distribution, then d χ 2 ( p, q ) ⩽ ε 2 .
with probability at least 5/6.
The algorithm uses O (( (cid:80) dℓ =1 n ℓ ) /ε 2 ) samples from P .
Theorem 1.4 (Daskalakis et al.
[2018, Theorem 1]) .
There exists an efficient algorithm which, given samples from a distribution P and a known reference distribution Q over [ n ] , as well as a distance parameter ε ∈ (0 , 1] , distinguishes between the cases (i) d χ 2 ( P, Q ) ⩽ ε 2 and (ii) d H ( P, Q ) ⩾ ε with probability at least 5 / 6 .
The algorithm uses O (cid:0) n 1 / 2 /ε 2 (cid:1) samples from P .
Lemma 1.5 (Batu et al.
[2001, Proposition 1]) .
Let P be a discrete distribution supported on [ n ] × [ m ] , with marginals P 1 and P 2 .
Then, we have min Q 1 ,Q 2 d TV ( P, Q 1 ⊗ Q 2 )
⩾ 13 d TV ( P, P 1 ⊗ P 2 ) , where the minimum is taken over all distributions Q 1 over [ n ] and Q 2 over [ m ] .
The Ω(2 d/ 2 n/ε 2 ) Lower Bound
In this section, we prove our main technical result: a lower bound on the sample complexity of testing whether a degree- d Bayes net is a product distribution.
In the interest of space, we omit some details of the derivations: the interested reader can find them in Appendix A.
Theorem 2.1.
Let d ⩽ c · log n , where c > 0 is a sufficiently small absolute constant.
Then, testing whether an arbitrary degree- d Bayes net over { 0 , 1 } n is a product distribution or is ε -far from every product distribution requires Ω(2 d/ 2 n/ε 2 ) samples.
This theorem considerably generalizes the lower bound of Ω( n/ε 2 ) established in Canonne et al. [2020] for the case of trees 3 ( d = 1 ).
To establish our result, we build upon (and considerably extend) their analysis; in particular, we will rely on the following “mixture of trees” construction, which can be seen as a careful mixture of ( 2 d − 1 of) the hard instances from the lower bound of [Canonne et al., 2020, Theorem 14]. Figure 1 shows an illustrative example of our lower bound constructions.
Notation.
Throughout, for given n, d, ε , we let N := n − d + 1 (without loss of generality assumed to be even), D := 2 d − 1 , δ := ε √ n , and
[Equation]
Definition 2.2 (Mixture of Trees) .
Given parameters
⩽
d ⩽ n and δ ∈ (0 , 1] , we define the probability distribution D n,d,δ over degree- d Bayes nets by the following process.
Choose a perfect matching λ of [ N ] uniformly at random (where N = n − d + 1 ), i.e., a set of N/ 2 disjoint pairs; 2.
Draw i.i.d. µ 1 , . .
. , µ D uniformly at random in { 0 , 1 } N/ 2 ; 3.
For ℓ ∈ [ D ] , let p ℓ be the distribution over { 0 , 1 } N defined as the Bayes net with tree structure λ , such that if λ k
=
( i, j ) ∈
λ then the corresponding covariance between variables
X i , X j is
[Equation]
Let the resulting distribution P λ,µ over { 0 , 1 } n be
[Equation]
where ι : { 0 , 1 } d − 1 → [ D ] is the indexing function, mapping the binary representation to the corresponding number.
That is, D n,d,δ is the uniform distribution over the set of degree- d Bayes nets where the first d −coordinates form a “pointer” to one of the 2 d − 1 tree Bayes nets sharing the same tree structure (the matching λ ), but with independently chosen covariance parameters (the D parameters µ 1 , . . . , µ D ). [Equation] X λ 1 [1] X λ 1 [2]
X λ 2 [1] X λ 2 [2] ··· [Equation] [Equation]
[Equation]
[Equation]
ι (
[Equation]
[Equation]
[Equation]
− 1)
[Equation]
[Equation]
With this construction in hand
Theorem 2.1 will follow from the next two lemmas:
Lemma 2.3 (Indistinguishability) .
There exist absolute constants c, C > 0 such that the following holds.
For Ω(1) ⩽ d ⩽ c log n , no m -sample algorithm can distinguish with probability at least 2 /between a (randomly chosen) mixture of trees P ∼ D n,d,ε/ √ n and the uniform distribution U over { 0 , 1 } n , unless m ⩾ C · 2 d/ 2 n/ε 2 .
Lemma 2.4 (Distance from product) .
Fix any 0 ⩽ d ⩽ n 2 and ε ∈ (0 , 1] .
With probability at least 9 / 10 over the choice of P ∼ D n,d,ε/ √ n , P is Ω( ε ) -far
from every product distribution on { 0 , 1 } n .
Note that this guarantees farness from every product distribution, not just from the uniform distribution.
We focus on the proof sketch of Lemma 2.3 in the next subsection, and defer the proof of Lemma 2. to the appendix A.2.
Throughout, we fix n , d , and ε ∈ (0 , 1] .
2.1 Sample Complexity to distinguish from Uniform (Lemma 2.3)
Proof sketch.
Following the original analogous analysis, we first use Ingster’s method to upper bound square TV distance in (4) and after a series of algebraic calculations, we arrive at (6).
This is where we improve upon the original analysis by substituting a tighter upper bound (7).
This leads us to some of the most technical portions of the paper.
To upper bound the inner expectation of (8), we use Lemma 2.5 to bound the unwieldy expression (average over z κ j,i j and raised by m ) by an expectation of a multinomial variable ⃗α in the expression (cid:81)
Di =1 (cid:81) Kj =1 cosh(2 α i δ j ) in (9); then, with some careful analysis and some tools on MGF (Moment Generating Function) of Binomial and Multinomial from Section B, we can upper bound the latter expression in (12), which finally gives us the sample complexity lower bound.
Details.
We now proceed with the proof of Lemma 2.3, starting with some convenient notations; some of the technical lemmas and facts used here are stated and proven in Appendix B. Let θ = ( λ, µ 1 , . .
, µ 2 d − 1 ) , where each µ k ∈ {± 1 } N/ 2 , and let P θ be the distribution for the mixture of trees construction from Definition 2.2.
The following denotes the matching count between ( λ, µ ) and x as the quantity
[Equation]
We will also introduce an analogous quantity with an “offset”, for x ch =
( x d , . . .
, x n ) , referring exclusively to the child nodes of x (i.e., the last N nodes, which are the “children” of the first d −“pointer nodes” in our construction),
[Equation]
and
[Equation]
To denote the parameters of the “mixture of trees”, we write θ i :=
( λ, µ i ) (for i ∈
[ D ] ), recalling that the matching parameter λ is common to all D tree components.
Since each µ i corresponds to one of the values of ( x 1 , . . .
, x d − 1 ) ∈ { 0 , 1 } d − 1 , we as before use ι : { 0 , 1 } d − 1 → [ D ] to denote the indexing function (so that, for instance, ι ( x [Equation] ) = 0 ).
We finally introduce three more quantities, related to the matching and orientations parameters across the D components of the mixture:
[Equation]
For ease of notation, we define A i :=
A θ i ,θ ′ i , B
i :=
B θ i ,θ ′ i and C
i :=
C θ i ,θ ′ i ; and note that C
i =
C 1 , as it only depends on λ (not on the orientation µ i ).
To prove the indistinguishability, we will bound the squared total variation distance (or equivalently, squared ℓ 1 ) distance between the distributions of m samples from (the uniform mixture of) P θ and
U by a small constant; that is, between Q :=
E θ [ P ⊗ m θ ] and U ⊗ m .
From Ingster’s method (see, e.g., [Acharya et al., 2020, Lemma III.8.]), by using chi-square divergence as an intermediate step we get
[Equation]
where τ ( θ, θ ′ ) :
= E x ∼ U (cid:104)(cid:16) [Equation] x
[Equation] x [Equation] (cid:17)(cid:16)
[Equation] x ) [Equation] x
[Equation] x [Equation]
(cid:17)(cid:105) . In order to get a handle on this quantity τ ( θ, θ ′ ) , we start by writing the expression for the density P θ . For any x ∈ { 0 , 1 } n , recalling Itemof Definition 2.2, P θ ( x ) = 12 n (1 + 4 δ ) c ( λ,µ ι ( x ) ,x ) (1 − 4 δ ) N 2 − c ( λ,µ ι ( x ) ,x ) .
Substituting this in the definition of τ , we get an expression depending on z 0 :
= 1+4 δ 1 − 4 δ .
and the probability-generating function (PGF) of c ch ( λ, µ, x ) .
Observing that, as x ∼ U N and for fixed λ, µ we have that c ch ( λ, µ, x ) ∼ Bin (cid:0) N 2 , 12 (cid:1) , we can then massage this expression to get
[Equation]
where the product is taken over all cycles in the multigraph G θ,θ ′ induced by the two matchings; and, given a cycle σ , B ( σ ) is the probability distribution defined as follows.
Say that a cycle σ is even (resp., odd ) if the number of edges with weight 1 along σ is even (resp., odd); that is, a cycle is even or odd depending on whether the number of negatively correlated pairs along the cycle is an even or odd number.
If σ is an even cycle , then B ( σ ) is a Binomial with parameters | σ | and 1 / 2 , conditioned on taking even values.
Similarly, if σ is an odd cycle , B ( σ ) is a Binomial with parameters | σ | and 1 / 2 , conditioned on taking odd values.
It follows that E α ∼B ( σ ) [ z α 0 ] is given by the following expression.
[Equation]
Denote S e,i :=
S e ( θ i , θ ′ i ) =
{ σ ∈ cycle( θ i , θ ′ i ) : | σ | ⩾ 4 , σ is even } , and similarly S o,i for odd cycles.
We would drop λ, µ or i , when clear from context.
We first expand E α [Equation]
] as follows:
[Equation]
[Equation] [Equation] We now improve upon the analogous analysis from [Canonne et al., 2020, Claim 12] to obtain a better upper bound for the remaining terms; indeed, the bound they derived is e O ( ε 4 /n ) , which was enough for their purposes but not ours (since it does not feature any dependence on d ).
Crucially, we instead derive the below inequality whose proof can be found in Appendix C.1:
[Equation]
for some absolute constant c ′ > 0 .
We will have e c ′ · mε [Equation] N
[Equation]
⩽ [Equation] √ Dn ) if D = O ( n/ε 6 ) , and this restriction on D is satisfied for the regime of parameters considered in our lower bound, d
= O (log n ) .
Letting R :
=
| A 1 | + | B 1 | ⩽ N/ 2 and z 1 := 1+(4 δ ) 2 1 − (4 δ ) 2 , with (6) and some calculations,
E θ,θ ′
[(1 + τ ( θ, θ ′ )) m ]
[Equation]
Fix a pair λ, λ ′ ; we have that the | A i | ’s are i.i.d.
Bin( R, 1 / 2) random variables.
We now introduce
R ′ :
= |{ σ 1 : | σ 1 | = 4 }| = |{ σ i : | σ i | = 4 }| , which is the random variable denoting how many cycles have length exactly 4.
In particular, we have R ′
⩽ N 4 , since (cid:80) σ : | σ |
⩾ 4 σ = | C | ⩽ N ; more specifically, we have R ′
⩽
N − 2 R⩽ N 4 .
Further, define κ i as the number of cycles of length 4 which have an even total number of negative correlations; that is, the number of cycles σ such that µ i , µ ′ i impose either 0, 2, or 4 negatively correlated pairs along that cycle.
Since µ, µ ′ are uniformly distributed, being odd or even each has probability 1 / 2 , and thus κ i ∼
Bin (cid:0) R ′ , 12 (cid:1) .
Moreover, while κ i and A i both depend on µ i , µ ′ i , they by definition depend on disjoint subsets of those two random variables: thus, because each correlation parameter is chosen independently, we have that κ i and A
i are independent conditioned on ( R, R ′ ) .
Now, recalling our setting of z 2 = 1+(4 δ ) 4− (4 δ ) 4 and fixing a realization of R, R ′ , we have
[Equation]
where (9) follows from the following lemma:
Lemma 2.5.
There exists an absolute constant δ 0 ≈ 0 .
96 such that the following holds.
Let K ⩾and R 1 , . .
, R K be integers, and δ 1 , . . .
, δ K ∈ (0 , δ 0 ] .
Suppose that κ j, 1 , . . .
, κ j,D ∼ Bin (cid:0) R j , 12 (cid:1) , are i.i [Equation] d. [Equation]
and mutually independent across 1 ⩽ j ⩽ K [Equation] and z j := 1+ δ j 1 − δ j . Then
[Equation]
where ( α 1 , . .
. , α D ) follows a multinomial distribution with parameters m and (1 /D, . .
, 1 /D ) .
We now focus on the expectation on the right (last factor of the RHS of (9)): using that cosh u ⩽ min( e u 2 / 2 , e u ) for u ⩾ 0 , it can be shown, setting ∆ :
= 1 /δ 2 = n/ε 2 , that
[Equation]
where the threshold ∆ was chosen as the value for which the term realizing the minimum changes.
We first bound the product of the last two expectations:
[Equation]
(12) where we applied negative association (see, e.g., Dubhashi and Ranjan [1996, Theorem 13]) on both expectations for (11); and then got (12) by Lemmas B.7 and B.3 (for the latter, noting that tm = 2 δ 8 mR ′ ⩽ 1 / 16 ; and, for the former, assuming with little loss of generality that ε ⩽ 1 / (4 √ 2) ).
Applying Lemma B.6 to the first (remaining) factor of the LHS above as 8 δ 2 R ⩽ 4 and D ⩾ Ω(1) , we get
[Equation]
recalling that R ′
⩽ N/ 4 ⩽ n/ 4 , and our assumption that m ⩽ C ′
√ Dn/ε 2 .
Combining (7), (8) and (9), what we showed is
[Equation]
where the equality follows from the definition of z 1 , z 2 .
To conclude, we will use the fact that, for every k ⩾ 0 , Pr[ R > k ] ⩽ 1 k ! , which was established in Canonne et al.
[2020, p.46].
By summation by parts, one can show that this implies E R (cid:2)
e αR (cid:3) ⩽ 1+(1 − e − α )( e e α − 1) α → 0 −−−→ 1+ α ( e − 1) for any α > 0 , and so, in our case, E θ,θ ′
[(1+ τ ( θ, θ ′ ))
m ] ⩽ (1+ o (1))
e 128 · C ′ (1+(1 − e − 32 C ′ 2 )( e e 32 C ′ 2 − 1))
In particular, the RHS can be made arbitrarily close to 1 by choosing a small enough value for the constant C ′ (in the bound for m ).
By (4), this implies the desired bound on ∥ Q − U ⊗ m ∥ 21 , and thus establishes Lemma 2.3.
Upper Bound for Independence Testing
In this section, we establish the upper bound part of Theorem 1.1, stated below:
Theorem 3.1.
There is an algorithm (Algorithm 1) with the following guarantees: given ε ∈ (0 , 1] and sample access to an unknown degree- d Bayes net P , the algorithm takes O ( d 2 2 d/ 2 n log( n ) /ε 2 ) samples from P , and distinguishes with probability at least 2 / 3 between the cases (i) P is a product distribution, and (ii) P is at total variation distance at least ε from every product distribution.
Input : Independent samples from a degree- d Bayes net P over { 0 , 1 } n , ε ∈ (0 , 1]
Set δ ← 1 3 ( nd +1 ) , ε ′ ← ε √ 2 n (1+ √ d +1) , and m ← O (cid:16) 2 d/ 2 ε ′ 2 log 1 δ (cid:17)
Take a multiset S of m samples from P , where δ ← 1 / (3 (cid:0) nd +1 (cid:1) ) for every subset T ⊆ [ n ] of d + 1 nodes do /
* We can generate one sample from P T given one from P */
Use the m samples from S to generate m i.i.d.
samples from P T
Call Algorithm 2 with distance parameter ε ′ and failure probability δ , using the m samples from P T /
This is over { 0 , 1 } d +1 .
*/ if all (cid:0) nd +1 (cid:1) tests accepted then return accept return reject
As discussed in the introduction, the key components of our algorithm are performing the testing in Hellinger distance, in order to use the subadditivity result of Daskalakis and Pan [2017]; and using as subroutine an independence testing algorithm under Hellinger distance.
As no optimal tester for this latter task was known prior to our work, our first step is to derive such an algorithm by adapting the “testing-by-learning” framework of Acharya et al.
We emphasize that, in view of the relation 12 d 2TV ⩽ d 2H ⩽ d TV , this is a strictly stronger statement than the analogous known
O (2 n/ 2 /ε 2 ) -sample algorithm for testing independence under total variation distance [Diakonikolas and Kane, 2016, Acharya et al., 2015], which only implies an O (2 n/ 2 /ε 4 ) sample complexity for testing independence under Hellinger distance.
Lemma 3.2.
There exists an algorithm (Algorithm 2) with the following guarantees: given a parameter ε ∈ (0 , 1] and sample access to an unknown distribution P over { 0 , 1 } n , it takes O (2 n/ 2 /ε 2 ) samples from P , and distinguishes with probability at least 2 / 3 between the cases (i) P is a product distribution, and (ii) P is at Hellinger distance at least ε from every product distribution.
Input : Independent samples from the target distribution over { 0 , 1 } n , ε ∈ (0 , 1]
Set m 1 ← O (cid:0) n/ε 2 (cid:1) , and m 2 ← O (cid:0) 2 n/ 2 /ε 2 (cid:1)
Take two multisets S 1 and S 2 of samples with size m 1 , m 2 respectively from P ˆ P ← call the algorithm of Lemma 1.3 with the samples from S
Call the tester in Theorem 1.4 with samples from S 2 , to test P with reference to ˆ P with distance ε if tester accepted then return accept return reject
We will next require the following lemma, whose proof is deferred to Appendix C.2:
Lemma 3.3.
Let P be a distribution on { 0 , 1 } n , and P ′ =
( π 1 P ) ⊗ · · · ⊗ ( π n P ) be the prod- uct of marginals of P .
Denoting by Q the set of all product distributions on { 0 , 1 } n , we have min
[Equation]
We now have all the elements to prove Theorem 3.1.
As discussed in the introduction, the idea is the following: when P is a product distribution, then the distribution induced by P ′ on any subset of d + 1 nodes is still a product distribution.
However, by the above localization Corolloary 1.2, when P is far from every product distribution, we can localize the farness between P and Q in one of the subsets of d + 1 nodes.
We also know that P ′ , the product of marginals P , is not too bad of an approximation to the closest Q in the product space as suggested by Lemma 3.3.
Thus, testing independence using P ′ as a proxy and paying an extra factor of O ( d ) to compensate in accuracy suffice.
Details can be found in Appendix C.1.
Acknowledgments.
Yang would like to thank Vipul Arora and Philips George John for the helpful discussions on the lower bound analysis; and Vipul, specifically, for providing valuable feedback on the manuscript
A Detailed version of Section
In this section, we prove our main technical result: a lower bound on the sample complexity of testing whether a degree- d Bayes net is a product distribution.
Theorem 2.1.
Let d ⩽ c · log n , where c > 0 is a sufficiently small absolute constant.
Then, testing whether an arbitrary degree- d Bayes net over { 0 , 1 } n is a product distribution or is ε -far from every product distribution requires Ω(2 d/ 2 n/ε 2 ) samples.
This theorem considerably generalizes the lower bound of Ω( n/ε 2 ) established in Canonne et al. [2020] for the case of trees ( d = 1 ).
To establish our result, we build upon (and considerably extend) their analysis; in particular, we will rely on the following “mixture of trees” construction, which can be seen as a careful mixture of ( 2 d − 1 of) the hard instances from the lower bound of [Canonne et al., 2020, Theorem 14].
Notation.
Throughout, for given n, d, ε , we let N := n − d + 1 (without loss of generality assumed to be even), D := 2 d − 1 , δ := ε √ n , and
[Equation]
Definition 2.2 (Mixture of Trees) .
Given parameters
⩽
d ⩽ n and δ ∈ (0 , 1] , we define the probability distribution D n,d,δ over degree- d Bayes nets by the following process.
Choose a perfect matching λ of [ N ] uniformly at random (where N = n − d + 1 )
, i
e., a set of N/ 2 disjoint pairs; 2.
Draw i.i.d.
µ 1 , . .
. , µ D uniformly at random in { 0 , 1 } N/ 2 ; 3.
For ℓ ∈ [ D ] , let p ℓ be the distribution over { 0 , 1 } N defined as the Bayes net with tree structure λ , such that if λ k
=
( i, j ) ∈
λ then the corresponding covariance between variables X i , X j is
[Equation]
Let the resulting distribution P λ,µ over { 0 , 1 } n be
[Equation]
where ι : { 0 , 1 } d − 1 → [ D ] is the indexing function, mapping the binary representation to the corresponding number.
That is, D n,d,δ is the uniform distribution over the set of degree- d Bayes nets where the first d −coordinates form a “pointer” to one of the 2 d − 1 tree Bayes nets sharing the same tree structure (the matching λ ), but with independently chosen covariance parameters (the D parameters µ 1 , . . . , µ D ).
With this construction in hand, Theorem 2.1 will follow from the next two lemmas:
Lemma 2.3 (Indistinguishability) .
There exist absolute constants c, C > 0 such that the following holds.
For Ω(1) ⩽ d ⩽ c log n , no m -sample algorithm can distinguish with probability at least 2 /between a (randomly chosen) mixture of trees P ∼ D n,d,ε/ √ n and the uniform distribution U over { 0 , 1 } n , unless m ⩾ C · 2 d/ 2 n/ε 2 .
Lemma 2.4 (Distance from product) .
Fix any 0 ⩽ d ⩽ n 2 and ε ∈ (0 , 1] .
With probability at least 9 / 10 over the choice of P ∼ D n,d,ε/ √ n , P is Ω( ε ) -far
from every product distribution on { 0 , 1 } n .
Note that this guarantees farness from every product distribution, not just from the uniform distribution.
We first establish Lemma 2.3 in the next subsection, before proving Lemma 2.4 in Section A.2.
Throughout, we fix n , d , and ε ∈ (0 , 1] .
A.1 Sample Complexity to distinguish from Uniform (Lemma 2.3)
We here proceed with the proof of Lemma 2.3, starting with some convenient notations; some of the technical lemmas and facts used here are stated and proven in Section
B. Let θ =
( λ, µ 1 , . . .
, µ 2 d − 1 ) , where each µ k ∈ {± 1 } N/ 2 , and let P θ be the distribution for the mixture of trees construction from Definition 2.2.
The following denotes the matching count between ( λ, µ ) and x as the quantity c (
[Equation]
and ( [Equation]
[Equation] (cid:9)(cid:12)(cid:12) [Equation]
We will also introduce an analogous quantity with an “offset”, for x ch =
( x d , . . .
, x n ) , referring exclusively to the child nodes of x (i.e., the last N nodes, which are the “children” of the first d −“pointer nodes” in our construction),
[Equation]
To denote the parameters of the “mixture of trees,” we write θ i :=
( λ, µ i ) (for i ∈
[ D ] ), recalling that the matching parameter λ is common to all D tree components.
Since each µ i corresponds to one of the values of ( x 1 , . . .
, x d − 1 ) ∈ { 0 , 1 } d − 1 , we as before use ι : { 0 , 1 } d − 1 → [ D ] to denote the indexing function (so that, for instance, ι ( x 1 = · · · = x d − 1 = 0) = 0 ).
We finally introduce three more quantities, related to the matching and orientations parameters across the D components of the mixture: [Equation] pairs unique to
[Equation]
For ease of notation, we define A i :=
A θ i ,θ ′ i , B
i :=
B θ i ,θ ′ i and C
i :=
C θ i ,θ ′ i ; and note that C
i =
C 1 , as it only depends on λ (not on the orientation µ i ).
To prove the indistinguishability, we will bound the squared total variation distance (or equivalently, squared ℓ 1 ) distance between the distributions of m samples from (the uniform mixture of) P θ and
U by a small constant; that is, between Q :=
E θ [ P ⊗ m θ ] and U ⊗ m .
From Ingster’s method (see, e.g., [Acharya et al., 2020, Lemma III.8.]), by using chi-square divergence as an intermediate step we get
[Equation]
[Equation]
where τ ( θ, θ ′ ) :
=
E x ∼ U
[Equation]
P
[Equation]
x
[Equation]
−
[Equation]
(cid:17)(cid:105) .
In order to get a handle on this quantity τ ( θ, θ ′ ) , we start by writing the expression for the density P θ (for a given parameter θ of the mixture of trees).
For any x ∈ { 0 , 1 } n , recalling Item 4 of Definition 2.2,
[Equation]
Substituting this in the definition of τ
[Equation]
we get
[Equation]
where z 0 :
= 1+4 δ 1 − 4 δ .
As x ∼ U N , for fixed λ, µ we have that c ch ( λ, µ, x ) follows a Bin (cid:0) N 2 , 12 (cid:1) distribution; recalling the expression of the Binomial distribution’s probability generating function, we then have
[Equation]
Using this to simplify the last two terms of (15)
[Equation]
we obtain
[Equation]
where the product is taken over all cycles in the multigraph G θ,θ ′ induced by the two matchings; and, given a cycle σ , B ( σ ) is the probability distribution defined as follows.
Say that a cycle σ is even (resp., odd ) if the number of edges with weight 1 along σ is even (resp., odd); that is, a cycle is even or odd depending on whether the number of negatively correlated pairs along the cycle is an even or odd number.
If σ is an even cycle , then B ( σ ) is a Binomial with parameters | σ | and 1 / 2 , conditioned on taking even values.
Similarly, if σ is an odd cycle , B ( σ ) is a Binomial with parameters | σ | and 1 / 2 , conditioned on taking odd values.
It follows that E α ∼B ( σ ) [ z α 0 ] is given by the following expression.
[Equation]
Denote
[Equation]
We will often drop λ, µ or i , when clear from context.
We expand E α ∼B ( σ ) [ z α 0 ] as follows: [Equation] σ : | σ | ⩾ E
[Equation]
σ
[Equation]
0 ] =
[Equation]
, even (
[Equation]
[Equation]
[Equation]
|
[Equation]
|
[Equation]
|
[Equation]
odd (
[Equation]
|
[Equation]
|
[Equation]
[Equation]
0 ) | σ |
[Equation]
|
[Equation]
=
[Equation]
|
[Equation]
even
[Equation]
[Equation]
1 +
[Equation]
[Equation]
odd
[Equation]
[Equation]
[Equation]
(cid:19)
|
[Equation]
=
[Equation]
σ : |
[Equation]
[Equation]
| σ |
[Equation]
| σ |
[Equation]
[Equation]
[Equation]
o (
[Equation]
[Equation]
δ ) |
[Equation]
) = (
[Equation]
[Equation] σ : | σ | ⩾ [Equation] | σ | 2 (cid:80) σ : | σ | ⩾ 4 | σ | (cid:89)
[Equation]
e (
[Equation]
+ (
[Equation]
δ ) | σ | )
[Equation]
σ
[Equation]
o (1 − (
[Equation]
δ ) | σ | ) =
(1 +
[Equation]
0 ) | C | 2 | C | (cid:89) σ ∈S e (1 + (
[Equation]
δ ) | σ | ) (cid:89) σ ∈S o (
[Equation] [Equation] 4 δ ) | σ | ) where for the last equality we used that (cid:80) σ : | σ | ⩾ 4 | σ | = | C | . We now improve upon the analogous analysis from [Canonne et al., 2020, Claim 12] to obtain a better upper bound for the remaining terms; indeed, the bound they derived is e O ( ε 4 /n ) , which was enough for their purposes but not ours (since it does not feature any dependence on d ).
Let z 1 :=
1+(4 δ ) 2− (4 δ ) 2 .
In view of using the above expression to bound (16), we first simplify (part of) the summands of (16) by using the fact that
[Equation]
| =
N for all i , and following the same computations as in Canonne et al.
[Equation]
where the last equality uses the fact that the sum | A i | + | B i | only depends on the matchings λ, λ ′ (not the orientations µ i , µ ′ i ), and thus is independent of i .
Plugging this simplification into (16), and letting R :=
| A 1 | + | B 1 | ⩽ N/ 2 for convenience, we get
[Equation]
Next, we compute the expectation after raising the above to the power m .
[Equation]
[Equation]
The quantity inside the inner expectation is quite unwieldy; to proceed, we will rely on the following identity, which lets us bound the two product terms:
[Equation]
for some absolute constant c ′ > 0 .
We defer the proof of this inequality to Appendix C.4, and proceed assuming it.
Note that as long as D = O ( n/ε 6 ) , we will have e c ′ · mε 5 /N [Equation] 2 ⩽ [Equation]
[Equation]
√ Dn ) ,and this restriction on D is satisfied for the regime of parameters considered in our lower bound, d
= O (log n ) .
Fix a pair λ, λ ′ ; we have that the | A i | ’s are i.i.d.
Bin( R, 1 / 2) random variables.
We now introduce
R ′ :
= |{ σ 1 : | σ 1 | = 4 }| = |{ σ i : | σ i | = 4 }| , which is the random variable denoting how many cycles have length exactly 4.
In particular, we have R ′ ⩽ N 4 , since (cid:80) σ : | σ | ⩾ 4 σ = | C | ⩽ N ; more specifically, we have R ′
⩽
N − 2 R⩽ N 4 .
Further, define κ i as the number of cycles of length 4 which have an even total number of negative correlations; that is, the number of cycles σ such that µ i , µ ′ i impose either 0, 2, or 4 negatively correlated pairs along that cycle.
Since µ, µ ′ are uniformly distributed, being odd or even each has probability 1 / 2 , and thus κ i ∼
Bin (cid:0) R ′ , 12 (cid:1) .
Moreover, while κ i and A i both depend on µ i , µ ′ i , they by definition depend on disjoint subsets of those two random variables: thus, because each correlation parameter is chosen independently, we have that κ i and A
i are independent conditioned on ( R, R ′ ) .
Now, recalling our setting of z 2 = 1+(4 δ ) 4− (4 δ ) 4 and fixing a realization of R, R ′ , we have
[Equation]
where (19) follows from the following lemma, whose proof we defer to the end of the section:
Lemma 2.5.
There exists an absolute constant δ 0 ≈ 0 .
96 such that the following holds.
Let K ⩾and R 1 , . .
, R K be integers, and δ 1 , . . .
, δ K ∈ (0 , δ 0 ] .
Suppose that κ j, 1 , . . .
, κ j,D ∼ Bin (cid:0) R j , 12 (cid:1) , are i.i.d., and mutually independent across 1 ⩽ j ⩽ K , and z j := 1+ δ j 1 − δ j .
Then
[Equation]
where ( α 1 , . .
. , α D ) follows a multinomial distribution with parameters m and (1 /D, . .
, 1 /D ) .
We now focus on the expectation on the right (last factor of the RHS of (19)): using that cosh u ⩽ min( e u 2 / 2 , e u ) for u ⩾ 0 , we have, setting ∆ :
= 1 /δ 2 = n/ε 2 ,
E ⃗α
[Equation]
D (cid:89)
i
[Equation]
R (cosh(
[Equation]
R ′
[Equation]
⩽
[Equation] where the last step comes from the generalized Hölder inequality (or, equivalently, two applications of the Cauchy–Schwarz inequality) [Equation] and the threshold ∆ was chosen as the value for which the term realizing the minimum changes.
We first bound the product of the last two expectations:
[Equation]
⩽ E
[Equation]
[Equation]
R min(
[Equation]
2 i
[Equation]
) (cid:35) 1 /
E (cid:34) D
[Equation]
i =
e
[Equation]
2 i
[Equation]
8 R ′ [Equation] [Equation] (22) where we applied negative association (see, e.g., Dubhashi and Ranjan [1996, Theorem 13]) on both expectations for (21); and then got (22) by Lemmas B.7 and B.3 (for the latter, noting that tm = 2 δ 8 mR ′ ⩽ 1 / 16 ; and, for the former, assuming with little loss of generality that ε ⩽ 1 / (4 √ 2) ).
Applying Lemma B.6 to the first (remaining) factor of the LHS above as 8 δ 2 R ⩽ 4 and D ⩾ Ω(1) , we get E [Equation] E
[Equation]
2 R ) , recalling that R ′
⩽ N/ 4 ⩽ n/ 4 , and our assumption that m ⩽ C ′
√ Dn/ε 2 .
Combining (17), (18), and (19), what we showed is
[Equation]
where the equality follows from the definition of z 1 , z 2 .
To conclude, we will use the fact that, for every k ⩾ 0 ,
[Equation]
which was established in Canonne et al.
[2020, p.46].
By summation by parts, one can show that this implies
[Equation]
for any α > 0 , and so, in our case,
[Equation]
In particular, the RHS can be made arbitrarily close to 1 by choosing a small enough value for the constant C ′ (in the bound for m ).
By (14), this implies the desired bound on ∥ Q − U ⊗ m ∥ 21 , and thus establishes Lemma 2.3.
The remaining technical lemma.
It only remains to establish Lemma 2.5, which we do now.
Lemma 2.5.
There exists an absolute constant δ 0 ≈ 0 .
96 such that the following holds.
Let K ⩾and R 1 , . .
, R K be integers, and δ 1 , . . .
, δ K ∈ (0 , δ 0 ] .
Suppose that κ j, 1 , . . .
, κ j,D ∼ Bin (cid:0) R j , 12 (cid:1) , are i.i.d., and mutually independent across 1 ⩽ j ⩽ K , and z j := 1+ δ j 1 − δ j .
Then
[Equation]
[Equation]
[Equation]
where ( α 1 , . .
. , α D ) follows a multinomial distribution with parameters m and (1 /D, . .
, 1 /D ) .
Proof of Lemma 2.5.
We will require the following simple fact, which follows from the multinomial theorem and the definition of the multinomial distribution:
Fact A.1.
Let D be a positive integer and m be a non-negative integer.
For any x 1 , . . .
, x D ∈ R , we have
[Equation]
where ( α 1 , . .
. , α D ) follows a multinomial distribution with parameters m and (1 /D, . .
, 1 /D ) .
We now apply Fact A.1 inside the expectation of the LHS of the statement.
Note that the sets of random variables ⃗α = { α 1 , . .
. , α D } , ⃗κ 1 = { κ 1 , 1 , . .
, κ 1 ,D } , . . . ,⃗κ K = { κ K, 1 , . . .
, κ K,D } are mutually independent, since ⃗α are a set of auxiliary random variables derived from an averaging operation and by the assumption on ⃗κ j ; and we have that κ j, 1 , . . .
, κ j,D are i.i.d.,
[Equation]
K
[Equation]

 =
E
[Equation]
  E
[Equation]
j  
D (cid:89) i =
K (cid:89) j
= z α
i κ j
[Equation]
i j   
 =
E ⃗α    
[-D (cid:89) i = K (cid:89) j = (cid:18) 
 + z α i j (cid:19) R j   -][Equation]
Probability-Generating Function of a Binomial)
[Equation]
[-= (cid:32) z − α i / 
 j + z α i / 2 j (cid:33) R j   .-] Next, we will simplify the expression left inside by upper bounding it, using the fact that, given our assumption on δ j being bounded above by δ 0 , we have z j = 1+ δ j 1 − δ
j ⩽ e 4 δ j .
Thus,
[Equation]
as claimed.
A.2 Product Distributions Are Far from Mixture of Trees (Lemma 2.4)
In this subsection, we outline the proof of Lemma 2.4.
Our argument starts with Lemma A.2, which allows us to relate the total variation distance between the mixture and the product of its marginals to a simpler quantity, the difference between two components of this mixture.
Lemma A.2.
Let p be a distribution on { 0 , 1 } N × { 0 , 1 } M (with N, M ⩾ 2 ), and denote its marginals on { 0 , 1 } N , { 0 , 1 } M by p 1 , p 2 respectively.
Then, if p 1 is uniform,
[Equation]
This in turn will be much more manageable, as the parameters of these two mixture components are independent, and thus analyzing this distance can be done by analyzing Binomial-like expressions.
This second step is reminiscent of [Canonne et al., 2020, Lemma 8], which can be seen as a simpler version involving only one Binomial instead of two:
Lemma A.3.
There exist C 1 , C 2 > 0 such that the following holds.
Let ε ∈ (0 , 1] and n ⩾ C 1 , and let a, b be two integers such that a + b = n and b ⩾ 14 n .
Then, for δ := ε √ n , we have
[Equation]
This parameter b corresponds to the difference between the orientations parameters µ, µ ′ being large, which happens with high constant probability as long as n is large enough.
The proof of Lemma A. is deferred to Appendix C.3, and we hereafter proceed with the rest of the argument.
For fixed θ and x 2 , . . .
, x d , z := 1+4 δ 1 − 4 δ .
We will denote by µ, µ ′ the two (randomly chosen) orientation parameters corresponding to the mixture components indexed by (0 , x 2 , . . .
, x d ) and (1 , x 2 , . . .
, x d ) .
By Lemma
A.2 and Lemma 1.5, for any product distribution q ,
[Equation]
Let S 1 denote the set of pairs in the child nodes with common parameters between µ and µ ′ , and Sthe set of pairs with different parameters (that is, the definition of S 1 , S 2 is essentially that of A and
B from the previous section (p.15), but for equal matching parameters λ = λ ′ ).
In particular, we have that | S 2 | =
Hamming( µ, µ ′ ) ∼ Binomial (cid:0) N 2 , 12 (cid:1) and | S 1 ∪ S 2 | = N 2 .
Let ˜ c
( S, µ, x ) be the analogue of c ch ( λ, µ, x ) from (13), but only on a subset of pairs S instead of { d, . . .
, n } 2 ; i.e., ˜ c ( S, µ, x ) :
= (cid:12)(cid:12)(cid:8) ( i, j ) ∈ S : ∃ k ∈ N , λ k
= ( i − d + 1 , j − d + 1) and ( − 1) x i + x j = ( − 1) µ k (cid:9)(cid:12)(cid:12) .
Given any x, µ and µ ′ , the following holds from the definitions of ˜ c and c ch :
• Since S 1 ∪ S 2 contains all the pairs, c ch ( λ, µ, x ) =
˜ c ( S 1 , µ, x ) + ˜ c
( S 2 , µ, x ) (similarly for µ ′ ).
• Since S 1 (resp., S 2 ) contains exactly the pairs whose orientation is the same (resp., differs) between µ and µ ′ , we have ˜ c
( S 1 , µ ′ , x ) =
˜ c ( S 1 , µ, x ) and ˜ c
( S 2 , µ ′ , x ) + ˜ c ( S 2 , µ, x ) =
| S 2 | • For a fixed matching and a partition S 1 , S 2 of its N/ 2 pairs, given an orientation vector µ ∈ { 0 , 1 } N/ 2 , and fixed values 0 ⩽ k 1 ⩽ | S 1 | , 0 ⩽ k 2 ⩽ | S 2 | , there are 2 N/ 2 (cid:0) | S 1 | k 1 (cid:1)(cid:0) | S 2 | k 2 (cid:1) different vectors x ∈ { 0 , 1 } N such that ˜ c ( S 1 , µ, x ) = k 1 and ˜ c ( S 2 , µ, x ) = k 2 .
Using these properties, we have, assuming | S 2 | ⩾ 14 · N 2 and N bigger than some constant, (cid:88)
[Equation]
where C > 0 is an absolute constant, and for the last inequality we invoked Lemma A.3.
Recalling now that | S 2 | ∼ Bin (cid:0) N 2 , 12 (cid:1) , for N large enough we also have
[Equation]
Thus, combining the two along with (25), we conclude that
[Equation]
establishing Lemma 2.4.
□
B Useful results on the MGFs of Binomials and Multinomials
In this section, we establish various self-contained results on the moment-generating functions (MGF) and stochastic dominance of Binomials, truncated (or “capped”) Binomials, and multinomial distributions, which we used extensively in Section 2.1 and should be of independent interest.
Notably, derivations from Section 2 following (10) are direct consequences of the three lemmas in the section:
Lemma B.3, Lemma B.6 and Lemma B.7 below, which we restate and establish later in this section.
Lemma B.3.
Let X ∼ Bin
( m, p ) .
Then, for any t such that 0 < tm ⩽ 1 / 16 ,
[Equation]
Lemma B.6.
Suppose ⃗α =
( α 1 , . .
. , α D ) T follows a multinomial distribution with parameters m and (1 /D, . . .
, 1 /D ) , and ∆ ⩾ 40 D ≫ c 4 be such that m ⩽ c √ D ∆ .
Then, for any t ⩽ 4 and
D ⩾ Ω(1) , we have
[Equation]
Lemma B.7.
Let X ′ ∼ Bin
( m, p ) , and X :
= min( X ′ , ∆) , for some ∆ ⩽ m .
Then, for any t such that 0 < t ∆ ⩽ 1 / 8 and 0 < tmp ⩽ 1 / 16 , we have
[Equation]
B.1 Bounds on moment-generating functions
We start with some relatively simple statements:
Fact B.1.
If X ∼ Bin( m, p ) , then, for any 0 ⩽ t ⩽ 1 , E [ e tX ] ⩽ exp(2 tmp ) .
Proof.
This follows from computing explicitly E [ e tX ]
= (1 + p ( e t [Equation] where the first inequality uses that t ⩽ 1 .
We will also require the following decoupling inequality:
Lemma B.2.
Let F : R → R be a convex, non-decreasing function, and
X =
( X 1 , . . .
, X n ) be a vector of independent non-negative random variables.
Then
[Equation]
 where Y is an independent copy of X .
Proof.
Introduce a vector of independent (and independent of X ) Bern(1 / 2) random variables δ = ( δ 1 , . .
δ n ) ; so that E [ δ i (1 − δ j )]
= 14 1 i ̸ = j .
For any realization of X , we can write
[Equation]
and so, by Jensen’s inequality and Fubini, as well as independence of X and δ ,
[Equation]
This implies that there exists some realization δ ∗ ∈ { 0 , 1 } n such that
[Equation]
Let I :=
{ i ∈ [ n ] : δ ∗ i = 1 } .
Then (cid:80) i,j δ ∗ i (1 − δ ∗ j )
X i X j = (cid:80) ( i,
j ) ∈
I × I
c
X i X j , and we get
[Equation]
where the equality uses the fact that ( X i ) i ∈ I and ( X j ) j ∈ I c are independent (as I, I c are disjoint), and so replacing (cid:80) j ∈
I c
X j by the identically distributed (cid:80) j ∈
I
c
Y j does not change the expectation; and the second inequality uses monotonicity of F and non-negativity of X, Y , as 4 (cid:80) ( i,j ) ̸∈ I
×
I c
X i Y j ⩾ 0 .
(Note that up to (and including) (26), the assumption that the X i ’s are independent is not necessary; we will use this fact later on.)
Note that compared to the usual version of the inequality, we do not require that the X i ’s have mean zero; but instead require that they be non-negative, and that F be monotone.
We will, in the next lemma, apply Lemma B.2 to the function F ( x ) =
e 2 tx , for some fixed positive parameter t > 0 (so that F is indeed non-decreasing), and to X 1 , . . .
, X n independent Bernoulli r.v.’s.
Specifically, we obtain the following bound on the MGF of the square of a Binomial:
Lemma B.3.
Let X ∼ Bin
( m, p ) .
Then, for any t such that 0 < tm ⩽ 1 / 16 ,
[Equation]
Proof.
Write X =
(cid:80) mi
=1 X i , where the X i are i.i.d.
Bern( p ) (in particular, X i =
X 2 i ).
Then, by the
Cauchy–Schwarz inequality and the decoupling inequality from Lemma B.2, we have, for t > 0 ,
[Equation]
(27) where Y j ∼ Bern( p ) are i.i.d., and independent of the X
i ’s. Let Y =
(cid:80) mi =1 Y
i ∼ Bin( m, p ) .
From
Fact B.1, as long as 2 t ⩽ 1 , 8 tm ⩽ 1 , and 16 tmp ⩽ 1 (all conditions satisfied in view of our assumption),
[Equation]
and E (cid:2) e 2 tX (cid:3) ⩽ e 4 tmp .
Going back to (27), this implies
E
[Equation]
concluding the proof.
We will prove an MGF bound on the truncated Multinomial in Lemma B.6 (noting that using
MGF bound of Multinomial distribution is not nearly enough), as required by our analysis on the independence testing lower bound; prior to that, we will need two important lemmas: Lemma B. and Lemma B.5.
These two lemmas both try to bound the expression with a uniform and more manageable term.
Lemma B.4.
Fix m, ∆ , D such that m ∆ ⩽ c √ D for some c > 0 (and D > max(16 c 4 , e 100 ) ).
Fix any integer k > 0 and a tuple of non-negative integers ( a 1 , . .
. , a D ) summing to m such that
L := (cid:80) ki
=1 a i > k ∆ (in particular, k ⩽ c √ D ).
Suppose ( α 1 , . . .
, α D ) follows a multinomial distribution with parameters m and (1 /D, . . .
, 1 /D ) .
Then,
[Equation]
Proof.
Via a multinomial distribution grouping argument, the probability can be bounded by considering a grouping of two random variables, L 1 = (cid:80) ki
=
α i and L 2 = (cid:80) Di
= k +1 α
i , where ( L 1 , L 2 ) follows a multinomial distribution with parameters m and (cid:0) kD , D − kD (cid:1) , namely, recalling L = (cid:80) ki
=1 a i and setting T :
= (cid:80) Di =
k +1 a i ,
[Equation]
Moreover, note that m =
L + T .
Via Stirling’s approximation, we have
[Equation]
from which we can write, taking the logarithm for convenience, log
[Equation]
where we used Gibbs’ inequality for (31); we then have (32) by log(1 + x ) ⩽ x for the first term. (33) then follows from k ⩽ c √ D and km ⩽
k ∆ · c √ D ⩽ L · c √ D .
Finally,
[Equation]
the last inequality as long as log D > 100 .
Lemma B.5.
Suppose ⃗α
=
( α 1 , . .
. , α D ) T follows a multinomial distribution with parameters m and (1 /D, . . .
, 1 /D ) , and that m ∆ ⩽ c √ D for some c > 0 , ∆ ⩾ 1 with ∆ ⩾ 40 D ⩾ Ω
( c 4 ) and
D > Ω(1) .
For any integer c √ D ⩾ k ⩾ 1 and any t ⩽ 4 ,
[Equation]
where ν ( ⃗α ) :
= |{ i : α i > ∆ }| denotes the number of coordinates of ⃗α greater than ∆ .
Proof.
Without loss of generality, (as later, we will sum over all combinations) assume that α 1 , . . .
, α k are the coordinates larger than ∆ , for some integer k ; and denote their sum by L .
Note that we then have k ∆ <
L ⩽ m ⩽ c ∆ √ D , and thus
⩽ k ⩽ c √ D .
[Equation]
A uniform bound on any α 1 , . .
. , α D as specified can be obtained from Lemma B.4; and, combining it with (34), we have an expression that does not depend on the value of ⃗α ; from which[-
 [Equation]-]
[Equation]
where (35) follows from 20 D log D ⩽ ∆ log∆ , which holds for ∆ ⩾ 40 D and D large enough (larger than some absolute constant); and the last inequality holds, given the above constraints, for D ⩾ 16 c 4 .
Lemma B.6.
Suppose ⃗α =
( α 1 , . .
. , α D ) T follows a multinomial distribution with parameters m and (1 /D, . . .
, 1 /D ) , and ∆ ⩾ 40 D ≫ c 4 be such that m ⩽ c √ D ∆ .
Then, for any t ⩽ 4 and
D ⩾ Ω(1) , we have
[Equation]
Proof.
Let ν ( ⃗α ) :
= |{ i : α i > ∆ }| denote the number of coordinates of ⃗α greater than ∆ .
Note that ν ( ⃗α ) <
L := m ∆ , and that L = c √ D s by assumption.
We break down the expectation by enumerating over the possible values for ν ( ⃗α ) , from 0 ⩽ k ⩽ L :
[Equation]
=
L (cid:88) k
=
E (cid:34) (cid:89) i : α i > ∆ e tα i · 1 [ ν ( ⃗α ) =
k ] (cid:35)
+ 1 · Pr[ ν ( ⃗α ) =
0] ⩽ L exp (cid:18) − 80∆ log D
(cid:19)
+ Pr[ ν ( ⃗α )
= 0] (36) ⩽ cD 1 / 2 exp (cid:18) − 80∆ log D
(cid:19)
+ 1 , where (36) follows from Lemma B.5.
We now state and prove our last lemma, Lemma B.7, on the MGF of the square of a truncated
Binomial:
Lemma B.7.
Let X ′ ∼ Bin
( m, p ) , and X :
= min( X ′ , ∆) , for some ∆ ⩽ m .
Then, for any t such that 0 < t ∆ ⩽ 1 / 8 and 0 < tmp ⩽ 1 / 16 , we have
[Equation]
Proof.
We will analyze the sampling process in Definition B.8:
Definition B.8.
Fix integers m ⩾ ∆ ⩾ 1 , and let X ′ 1 , . . .
, X ′ m be i.i.d.
Bern( p ) random variables.
Define the distribution of X 1 , . . .
, X m through the following sampling process:
Initialize X i =
for all i ∈ [ m ] ; sample { X ′ i } 1 ⩽ i ⩽ m as m i.i.d.
Bern( p ) ; 2.
If (cid:80) i ∈ [ m ] X ′ i < ∆ , let X i =
X ′
i for all i ∈ [ m ] ; 3.
If (cid:80) i ∈ [ m ] X ′ i ⩾ ∆ , let S ′
= { i ∈ [ m ] : X
′ i = 1 } and let S be a uniformly random subset of S ′ of size ∆ ; set X i =
X ′
i for i ∈ S .
Consider a sequence of random variable X 1 , . .
, X m as defined in Definition B.8; each X i (for 1 ⩽
i ⩽ m ) is supported on { 0 , 1 } (so that, in particular, X 2 i
= X i ); and X = (cid:80) i ∈ [ m ] X i .
By the
Cauchy–Schwarz inequality,
[Equation]
[Equation]
where Y 1 ∼ min(Bin( | I | , p ) , ∆) , Y 2 ∼ min(Bin( | I c | , p ) , ∆) and Y 1 is independent of Y 2 (and ( I, I c ) is some fixed, but unknown partition of [ m ] ).
(37) follows from the intermediate step (26) in the proof of Lemma B.2 (observing that x (cid:55)→ e tx is convex, and non-decreasing as t > 0 ; and using the remark from that proof about the independence of X i ’s not being required up to that step) and (38) follows from Lemma B.12.
We will implicitly use Facts B.9, B.10, and B.11 for the remaining calculations, eventually replacing most expressions with X ′ ∼ Bin( m, p ) .
Recalling that X ⩽ X ′ by definition, the first term of (38) can be bounded as E [ e 2 tX ] ⩽ e 4 tmp .
Moreover, from our assumption, tY 1 ⩽ t ∆ ⩽ 1 / 8 and tmp ⩽ [Equation]
Combined with the fact that
Y 1 , Y 2 is dominated by X ∼ min(Bin( m, p ) , ∆) and thus by X ′ ∼ Bin( m, p ) , we have
[Equation]
Going back to (38), this implies
[Equation]
concluding the proof.
Fact B.9.
Let X ∼ Bin
( m, p ) , and 0 < n ⩽ m .
Defining Y :
= min( X, n ) and Z := X
| X ⩽ n , we have, for every k ⩾ 0 ,
[Equation]
i.e., X ⪰ Y ⪰ Z , where ⪰ denotes first-order stochastic dominance.
Proof.
We can write the PMF of Z and Y , for all 0 ⩽ k ⩽ n ,
[Equation]
It follows that Pr[ Y ⩾ k ] =
Pr[ X ⩾ k ] 1 { k ⩽ n } , which gives the first part of the statement.
The second part follows from a direct comparison between the two CDF of Z, Y : indeed, for 0 ⩽ k ⩽ n ,
[Equation]
and this last inequality clearly holds.
We also record the facts below, which follow respectively from the more general result that first-order stochastic dominance is preserved by non-decreasing mappings, and from a coupling argument.
Fact B.10.
Consider two real-valued random variables X, Y , and n ⩾ 0 .
If X ⪰ Y , then min( X, [Equation] Y [Equation]
: for all k ,
[Equation]
i.e., the min operator preserves first-order stochastic dominance relation.
Fact B.11.
Let X ∼ Bin( n, p ) and Y ∼ Bin( m, p ) , where m ⩾ n .
Then X ⪯ Y .
Lemma B.12.
Let X 1 , . . .
, X m be sampled from the sampling process in Definition B.8, and I, I c be any partition of [ m ] .
Define Z I :=
(cid:80) i ∈
I
X
i , Z I c := (cid:80) i ∈ I
c X i , and Y I ∼ min(Bin( | I | , p ) , n ) ,
Y I c ∼ min(Bin( | I c | , p ) , n ) .
Then
[Equation]
Proof.
We prove the lemma by defining a coupling Z I ,
Z I c , Y I , Y I c such that Z I · Z I c ⩽ Y
I · Y I c with probability one.
The sampling process below will generate samples ( X i )
1 ⩽ i ⩽ m , Z I ,
Z I c , Y I , Y
I c for all possible realizations of I and I c .
In other words, from a given sequence { X ′ i } i ∈ [ m ] , we will generate { X i } i ∈ [ m ] , Y I 1 , Y I c 1 , Y I 2 , Y I c 2 , . . .
, Y I 2 m , Y I c
2 m , Z I 1 , Z I c 1 , Z I 2 , Z I c 2 , . . .
, Z I 2 m , Z I c 2 m , where the ( I i , I ci ) enumerate all partitions of [ m ] in two sets.
Initialize X i =
for all i ∈ [ m ] ; sample ( X ′ i )
1 ⩽ i ⩽ m as m i.i
d. Bern( p ) ; 2.
If (cid:80) i ∈ [ m ] X ′ i < n , let X i =
X ′
i for all i ∈ [ m ] ; 3.
If (cid:80) i ∈ [ m ] X ′ i ⩾ n , let S ′
= { i ∈ [ m ] : X
′ i = 1 } and let S be a uniformly random subset of S ′ with size n ; set X i =
X ′
i for i ∈ S .
For each I ∈ { I 1 , . . .
, I 2 m } , denote S ′
I =
S ′ ∩ I .
Select a uniformly random subset of S ′
I with at most n indices which is a superset of S ∩ I .
In more detail, if |S ∩ I | < n , select min( |S ′ I | , n ) − |S
∩ I | elements uniformly at random from S
′ I \ ( S ∩ I ) to add to S ∩ I , which becomes S I ; else, let S
I
=
S ∩ I .
Repeat a similar process for I c to obtain S I c .
For each I ∈ { I 1 , . . .
, I 2 m } , set Y I
=
(cid:80) i ∈S I X
′ i
and Y
I c
= (cid:80) i ∈ S
Ic X ′
i .
From the above definition, we can readily see that for any I , Y I ⩾ Z I and Y I c
⩾ Z I c .
What is left is to argue that the Y I ∼ min(Bin( | I | , p ) , n ) and Y I c ∼ min(Bin( | I c | , p ) , n ) .
We start by noting that for any k < n , { Y I = k } =
{|S I | = k } = {|S ′ I
| = k } .
The last equality comes from the fact that |S I | < n can only mean that |S ′
I | < n , and the selection process in step 4 will thus add all elements from S ′
I to S I .
From here, we have Pr[ Y I = k ] =
Pr[ |S ′ I
| =
k ] =
Pr[Bin( m, p ) =
k ] , for k < n ; and we have Pr[ Y
I = n ] = 1 − Pr
[ Y I < n ] =
Pr[Bin( m, p ) ⩾ n ] .
As a result,
Y I ∼ min(Bin( | I | , p ) , n ) .
Similarly, we can argue that Y I c ∼ min(Bin( | I c | , p ) , n ) .
C Deferred Proofs C.1 Proofs from Section
Proof of Lemma 3.2.
We analyze Algorithm 2: first we use the algorithm of Lemma 1.3 to learn P to d χ 2 distance ε 2 as if it was a product distribution, using O (cid:0) nε 2 (cid:1) samples.
Let ˆ P be the output of the learning algorithm.
Note that since Lemma 1.3 guarantees proper learning, ˆ P is a product distribution.
We then want to check that ˆ P is indeed close to P (in Hellinger distance), as it should if P were indeed a product distribution.
To do this, we use the algorithm of Theorem 1.4 on P , with reference distribution ˆ P and distance parameter ε ; and reject if, and only if, this algorithm rejects.
By a union bound, since both algorithms are correct with probability at least 5 / 6 , both are simultaneously correct with probability at least 2 / 3 ; we hereafter assume this is the case in our analysis.
The total sample complexity is O (cid:0) n/ε 2 (cid:1) + O (cid:0) √ 2 n /ε 2 (cid:1)
=
O (cid:0) 2 n/ 2 /ε 2 (cid:1) , as claimed.
We now argue correctness.
• Soundness.
Proof by contrapositive: if the algorithm accepts, this means, from the guarantees of Theorem 1.4, that d H ( P, ˆ P ) ⩽ ε .
Since ˆ P is a product distribution, we conclude that P is ε -close (in Hellinger distance) to being a product distribution.
• Correctness.
Assume that P is a product distribution.
Then, Lemma 1.3 ensures that d χ 2 ( P, ˆ P ) ⩽ ε 2 ; and thus, by Theorem 1.4 the second step will not reject, and the algorithm overall accepts.
Note that, by a standard amplification trick (independent repetition and majority vote), the probability of error can be reduced from 1 / 3 to any δ ∈ (0 , 1) at the price of a O (log(1 /δ )) factor in the number of samples.
Proof of Theorem 3.1.
We analyze Algorithm 1, denoting as in the algorithm by P ′ the product of marginals of P , and setting δ := 1 3 ( nd +1 ) , ε ′ :
= [Equation] 2 n
[Equation]
1+
[Equation]
d +1) , and
[Equation]
The sample complexity is thus immediate; further, note that, as stated in the algorithm, given m i.i.d. samples from P and a fixed set T ⊆ [ n ] of nodes, one can generate m i.i.d.
samples from P T by only keeping the relevant variables (those in T ) of each sample from P .
• Completeness.
Assume P is a product distribution.
Then, P T is a product distribution for every choice of T , and each of the (cid:0) nd +1 (cid:1) performs thus accepts with probability at least 1 − δ by Lemma 3.2.
Thus, by a union bound, all tests simultaneously accept with probability at least 1 − (cid:0) nd +1 (cid:1) · δ = 2 / 3 , and Algorithm 1 returns “accept.”
• Soundness.
Assume now that P is ε -far (in total variation distance) from every product distribution over { 0 , 1 } n .
A fortiori, it is ε -far from the product distribution P ′ , and thus we have
[Equation]
By Corollary 1.2, this means there exists some node i ∈ [ n ] along with the set of its (at most) d parents Π i such that, setting T :
= { i } ∪ Π i ,
[Equation]
Now, we can invoke our localization lemma, Lemma 3.3, to conclude that P T is not only far from P ′ T , it is far from every product distribution on T :
[Equation]
Thus, when this particular set T of d + 1 nodes is encountered by the algorithm, the corresponding independence test will reject with probability at least 1 − δ by Lemma 3.2, and the overall algorithm will thus reject with probability at least 1 − δ .
This concludes the proof: the sample complexity is O ( d 2 2 d/ 2 n log( n ) /ε 2 ) as claimed, and the tester is correct in both cases with probability at least 2 / 3 .
C.2 Proof of Lemma 3.
Lemma 3.3.
Let P be a distribution on { 0 , 1 } n , and P ′ =
( π 1 P ) ⊗ · · · ⊗ ( π n P ) be the prod- uct of marginals of P .
Denoting by
Q the set of all product distributions on { 0 , 1 } n , we have min
[Equation]
Proof.
Since squared Hellinger distance is an f -divergence, by the data processing inequality, we have that
[Equation]
By the subadditivity of Hellinger for Bayes nets from Corollary 1.2 along with (39), we obtain the following:
[Equation]
C.3 Proof of Lemma A.
Lemma A.3.
There exist C 1 , C 2 > 0 such that the following holds.
Let ε ∈ (0 , 1] and n ⩾ C 1 , and let a, b be two integers such that a + b = n and b ⩾ 14 n .
Then, for δ := ε √ n , we have
[Equation]
Proof.
By concentration of Binomials,
[Equation]
[Table]
[Table]
[Equation]
[Table]
[Equation]
41) where (40) and (41) follows from 1 − x ⩾ e − 2 x , 0 < x < 0 .
79 and e 4 x ⩾ (cid:16) 1+ x 1 − x (cid:17) ⩾
e 2 x , 0 < x < 0 .
All these inequalities hold for n larger some constant and every ε ∈ (0 , 1] .
Since b ⩾ 14 n , and by the summation above b − 2 k 2 ∈ (cid:104) − 4 √ b, − 2 √ b
[Equation] [Equation]
and therefore, summing up every term, we have our lower bound
C √ ab
[Equation]
⩾ Cε concluding the proof.
C.4 Proof of (7)
Fact C.1.
For any set of cycles such that (cid:80) i | σ i | ⩽ n , we have (cid:89) σ i :even | σ i | ⩾(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd | σ i | ⩾(1 − ( − 4 δ ) | σ i | )
⩽ e O (cid:16) ε 5 /n 32 (cid:17) (cid:89) σ i :even | σ i | = (1 + (4 δ ) 4 ) (cid:89) σ i :odd | σ i | = (1 − (4 δ ) 4 )
Proof.
We have (cid:89) σ i :even (1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd (1 − ( − 4 δ ) | σ i | ) =
(cid:89) σ i :even | σ i | ⩾(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd | σ i | ⩾(1 − ( − 4 δ ) | σ i | ) (cid:89) σ i :even | σ i | =
(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd | σ i | = (1 − ( − 4 δ ) | σ i | )
⩽ (cid:89) σ i :
| σ i | >(1 + (4 δ ) | σ i | ) (cid:89) σ i :even , | σ i | =
(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd , | σ i | =
(1 − ( − 4 δ ) | σ i | ) ⩽ (1 + (4 δ ) 5 ) n(cid:89)
σ i :even , | σ i | =
(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd , | σ i | =
(1 − ( − 4 δ ) | σ i | ) ⩽ e (4 δ ) 5 n/(cid:89)
σ i :even , | σ i | =
(1 + ( − 4 δ ) | σ i | ) (cid:89) σ i :odd , | σ i | =
(1 − ( − 4 δ ) | σ i | ) ⩽ e 256 ε 5 /n(cid:89)
σ i :even , | σ i | =
(1 + ( − 4 δ ) 4 ) (cid:89)
σ i :odd , | σ i | =
(1 − ( − 4 δ ) 4 )
D Structured Testing Lower Bound
Letting D = 2 n , we will rely on the construction from the “standard” lower bound of Paninski [2008] by picking a uniformly random subset S of { 0 , 1 } n of size D 2 .
Denote S the set of all such combinations of S , and define P no to be P
no := (cid:8) P =
+ Cε 2 U S + 1 −
Cε 2 U S c | S ∈ S (cid:9) , where
C > 0 is a suitable normalizing constant.
As before, U S denotes the uniform distribution on the set of variable S and P ∈ P no is a mixture of two uniform distributions on disjoint parts, with different weights.
It is known that Ω(2 n/ 2 /ε 2 ) samples are required to distinguish between such a randomly chosen
P and the uniform distribution U ; further, assume we know that the uniform distribution U is in C .
What remains to show is the distance , that is, “most” choices of P ∈ P
no are ε -far from C .
To argue that last part, we will use our assumption that C can be learned with m samples to conclude by a counting argument: i.e., we will show that there can be at most 2 mn or so “relevant” elements of C , while there are at least 2 2 Ω( n ) P
no that are ε -far from each other.
Suitably combining the two will establish the theorem below:
Theorem D.1.
Let C be a class of probability distributions over { 0 , 1 } n such that the following holds: (1) the uniform distribution belongs to C (2) there exists a learning algorithm for C with sample complexity m = m ( n, ε ) .
Then, as long as mn ≪ 2 O ( n )
, testing whether an arbitrary distribution over { 0 , 1 } n belongs to C or is ε -far from every distribution in C in total variation distance requires Ω(2 n/ 2 /ε 2 ) samples.
Proof.
As discussed above, indistinguishability follows from the literature [Paninski, 2008], and thus all we need to show now is that P no is far from every distribution in C .
By assumption (2), there exists an algorithm H : { 0 , 1 } mn → P (without loss of generality, we assume H deterministic) that can output an estimated distribution given m = m ( n, ε ) samples from P ∈ C .
Thus, for every P ∈ C given m i.i.d .
samples X [Equation]
In particular, this implies the weaker statement that, for every P ∈ C , there exists some x in { 0 , 1 } mn s.t.
P ∈ B ( H ( x ) , ε ) (where B ( x, r ) denotes the TV distance ball of radius r centered at x ).
By enumerating all possible values in { 0 , 1 } mn , we then can obtain an ε -cover { H ( x 1 ) , . . .
, H ( x 2 mn ) } of C , that is, such that C ⊆ (cid:83) 2 mn i =
1 B ( H ( x i ) , ε ) .
The ε -covering number of C is thus upper bounded by 2 O ( mn ) .
Next, we lower bound the size of P no by constructing an ε -packing P ε , where P ε = { P i ∈ P
no , i ∈ N : d TV ( P i , P j ) >
ε, i ̸
= j } .
For P, Q ∈ P no corresponding to two sets S, S ′ , each of size D 2 = 2 n − 1 , we have
[Equation]
For this to be at least ε , the pairrwise symmetric difference of (the sets corresponding to the) distributions in P ε should be at least D C = Ω(2 n ) .
We know, by, e.g., Blais et al.
[2019, Proposition 3.3] that there exist such families of balanced subsets of { 0 , 1 } n of cardinality at least Ω(2 2 ρn ) , where ρ >is a constant that only depends on C .
Thus, the size of P no is itself Ω(2 2 ρn ) ; combining this lower bound with the upper bound on the covering number of C concludes the proof.
As a corollary, instantiating the above to the class C of degree- d Bayes nets over n nodes readily yields the following:
Corollary D.2.
For large enough n , testing whether an arbitrary distribution over { 0 , 1 } n is a degree- d Bayes net or is ε -far from every such Bayes net requires Ω(2 n/ 2 /ε 2 ) samples, for any d = o ( n ) and ε ⩾ 2 − O ( n ) .
Proof.
We can obtain a learning upper bound of m =
O (2 d n log(2 d +1 n ) log( n dn ) /ε 2 ) for degree- d
Bayes nets by combining the known-structure case (proven in Bhattacharyya et al.
[2020]) with the reduction from known-structure to unknown-structure (via hypothesis selection/tournament [Canonne et al., 2020]).
We have mn ⩽
O
(2 d n 6 /ε 2 ) .
To have 2 mn ≪ 2 2 ρn , where ρ is some constant, we need mn < 2 O ( n ) , which requires d = o ( n ) and ε ⩾ 2 − O ( n ) for large enough n .
D.1 An Ω(2 d/ 2 √ n/ε 2 ) Lower Bound
In this section, we state and prove a simpler, but quantitatively weaker lower bound than Theorem 2. for independence testing, Theorem D.3.
This simpler lower bound is adapted from Canonne et al. [2020, Theorem 13] – the “mixture-of-products” construction.
Their analysis readily provides indistinguishability, and distance from the uniform distribution .
Thus, all we need here is to show that most of these hard instances (i.e., “mixtures of products”) are far from every product distribution (Lemma D.4), not just the uniform distribution.
While the Ω(2 d/ 2 √ n/ε 2 ) lower bound this yields is not as tight in terms of sample complexity, with a √ n dependence instead of n (at a high level, this is because we fix the Bayesian structure, and thus the algorithms have additional information they can leverage), the restriction on d is much milder than the one in Theorem 2.1, allowing up to d = n/ 2 .
Theorem D.3.
Let 1 ⩽
d ⩽ n/ 2 .
Testing whether an arbitrary degree- d Bayes net over { 0 , 1 } n is a product distribution or is ε -far from every product distribution requires Ω(2 d/ 2 √ n/ε 2 ) samples.
This holds even if the structure of the degree- d Bayes net is known.
Proof.
As discussed above, we will use the same “mixture-of-products” construction as in Canonne et al.
[2020, Theorem 13], which established a lower bound of Ω(2 d/ 2 √ n/ε 2 ) samples to distinguish it from the uniform distribution.
We first recall the definition of this “mixture-of-products” construction.
Letting N := n − d ⩾ n/ 2 , we define, for z ∈ {± 1 } N the product distribution p Z over { 0 , 1 } N by
[Equation]
where δ := ε √ N =
Θ
[Equation]
ε √ n (cid:17) .
A mixture-of-products distribution is then defined by choosing 2 d i.i.d.
Z 1 , . .
, Z 2 d ∈ {± 1 } N uniformly at random, and setting p Z 1 ,...,Z 2 d to be the distribution over { 0 , 1 } n which is uniform on the first d bits, and where the first d bits of x are seen as the binary representation (i.e., a “pointer”) for which p
Z i will be used for the last N bits of x .
That is,
[Equation]
where, analogously to Definition 2.2, ι : { 0 , 1 } d → [2 d ] is the indexing function, mapping the binary representation (here on d bits) to the corresponding number.
As mentioned in the preceding discussion, this construction was already used in Canonne et al. [2020, Theorem 13], where the authors show an Ω(2 d/ 2 √ n/ε 2 ) sample complexity lower bound to distinguish a uniformly randomly chosen mixture-of-products distribution (which is a degree- d Bayes net) from the uniform distribution (which is a product distribution).
For their theorem (a lower bound on testing uniformity ), they then conclude from the easy fact that every such mixture-of-products distribution is ε -far from the uniform distribution.
This is not enough for us, as, to obtain the lower bound stated in Theorem D.3, what we need is to show that every such mixture-of-products distribution (or at least most of them) is far from every product distribution, not just the uniform one.
This is the only missing part towards proving Theorem D.3, and is established in our next lemma:
Lemma D.4 (Distance from Product distributions) .
For p uniformly sampled from the mixture-ofproducts construction,
[Equation]
as long as n ⩾ d + C 1 , for some constants C 1 > 0 and n/ 2 ⩾ d .
This lemma will directly follow from Claim D.5 (below) and Lemma 1.5; the rest of this appendix is thus dedicated to proving the former, which states that most mixture-of-products distributions are far from the product of their marginals.
Claim D.5.
Given a mixture-of-products distribution p as in (43) , let p 1 be the marginal of p on the first d variables (parent nodes) and p 2 the marginal on the N last variables (child nodes).
Note that p 1 ⊗ p 2 is then a product distribution on { 0 , 1 } n .
Then, we have
[Equation]
as long as n ⩾ C 1 + d , for some constants C 1 ⩾ 0 and n ⩾ 2 d .
Proof.
Fix any mixture-of-products distribution p .
From Lemma A.2 and the structure of p as given in (43), one can show that
[Equation]
Denoting p ( · | 0 , x 2 , . .
, x d ) by p ι ( x 2 ,...,x d ) and p ( · | 0 , x 2 , . . .
, x d ) by q ι ( x 2 ,...,x d ) (where ι ( x 2 , . . .
, x d ) ∈ [2 d − 1 ] , abusing slightly the definition of the indexing function to extend it to d − 1 bits), we can rewrite this as
[Equation]
Now, since d ⩽ n/ 2 , one can show that, for every fixed t ,
[Equation] [Equation]
where the probability is taken over the choice of p (i.e., its 2 d parameters Z 1 , . .
, Z 2 d ), and C > 0 is an absolute constant.
We defer the proof of this inequality to the end of the appendix, and for now observe that the RHS is less than 1 / 10 for N greater than some (related) absolute constant C 1 > 0 .
We can then write, letting D := 2 d − 1 and X t :
= 1 { d TV ( p t , q t ) }
[Equation]
where the X t ’s are i.i.d.
Bernoullis with, by the above analysis, parameter α ⩾ 1 − e − C · N ⩾ 9 / 10 .
We then have
[Equation]
so it remains to show that the RHS is less than 1 / 10 .
Since E [ X t ] ⩾ 9 / 10 for all t , this readily follows from a Hoeffding bound, for d ⩾ 1 .
To conclude, we only need to prove (44), which (slightly rephrasing it)
tells us that two independent parameterizations p Z , p ′ Z will be at total variation distance at least Ω( ε ) far with overwhelming probability.
Proof of (44) .
Let distribution p Z , p Z ′ be defined as in (42), and Z, Z ′ be i.i.d.
and uniform on {± 1 } N .
The statement to show is then
[Equation]
We know (see, e.g., Kamath et al.
[2019, Lemma 6.4]) that as long as δ ⩽ 1 / 6 (which holds for n ⩾ 36 ), then the TV distance is related to the ℓ 2 distance between mean vectors µ Z , µ Z ′ ∈ [0 , 1] N as
[Equation]
Relating this ℓ 2 distance between mean vectors the Hamming distance between Z and Z ′ , we have
[Equation]
where Hamming( Z, Z ′ ) =
(cid:80) Ni =1
[ Z i ̸
= Z ′ i ] .
Noting that Hamming ( Z, Z ′ ) ∼ Bin( N, 1 / 2) , we have the following via Hoeffding’s inequality along with (46) and (47),
[Equation]
Since n/ 2 ⩾ d and thus, (cid:113) 4 δ 2 N⩾ 45 ε , we get (45).
This concludes the proof of Lemma D.4, and with it of Theorem D.3.