Estimation of Rényi Entropy and Mutual Information Based on Generalized Nearest-Neighbor Graphs
Dávid Pál, Barnabás Póczos, Csaba Szepesvári
Introduction
In a naïve approach to Rényi entropy and mutual information estimation, one could use the so called “plug-in” estimates. These are based on the obvious idea that since entropy and mutual information are determined solely by the density (and its marginals), it suffices to first estimate the density using one’s favorite density estimate which is then “plugged-in” into the formulas defining entropy and mutual information. The density is, however, a nuisance parameter which we do not want to estimate. Density estimators have tunable parameters and we may need cross validation to achieve good performance.
The entropy estimation algorithm considered here is direct—it does not build on density estimators. It is based on -nearest-neighbor (NN) graphs with a fixed . A variant of these estimators, where each sample point is connected to its -th nearest neighbor only, were recently studied by Goria et al. (2005) for Shannon entropy estimation (i.e. the special case ) and Leonenko et al. (2008) for Rényi -entropy estimation. They proved the weak consistency of their estimators under certain conditions. However, their proofs contain some errors, and it is not obvious how to fix them. Namely, Leonenko et al. (2008) apply the generalized Helly-Bray theorem, while Goria et al. (2005) apply the inverse Fatou lemma under conditions when these theorems do not hold. This latter error originates from the article of Kozachenko and Leonenko (1987), and this mistake can also be found in Wang et al. (2009b).
The first main contribution of this paper is to give a correct proof of consistency of these estimators. Employing a very different proof techniques than the papers mentioned above, we show that these estimators are, in fact, strongly consistent provided that the unknown density has bounded support and . At the same time, we allow for more general nearest-neighbor graphs, wherein as opposed to connecting each point only to its -th nearest neighbor, we allow each point to be connected to an arbitrary subset of its nearest neighbors. Besides adding generality, our numerical experiments seem to suggest that connecting each sample point to all its nearest neighbors improves the rate of convergence of the estimator.
The second major contribution of our paper is that we prove a finite-sample high-probability bound on the error (i.e. the rate of convergence) of our estimator provided that is Lipschitz. According to the best of our knowledge, this is the very first result that gives a rate for the estimation of Rényi entropy. The closest to our result in this respect is the work by Tsybakov and van der Meulen (1996) who proved the root- consistency of an estimator of the Shannon entropy and only in one dimension.
The third contribution is a strongly consistent estimator of Rényi mutual information that is based on NN graphs and the empirical copula transformation (Dedecker et al., 2007). This result is proved for Our result for Rényi entropy estimation holds for and , too. and . This builds upon and extends the previous work of Póczos et al. (2010) where instead of NN graphs, the minimum spanning tree (MST) and the shortest tour through the sample (i.e. the traveling salesman problem, TSP) were used, but it was only conjectured that NN graphs can be applied as well.
There are several advantages of using -NN graph over MST and TSP (besides the obvious conceptual simplicity of -NN): On a serial computer the -NN graph can be computed somewhat faster than MST and much faster than the TSP tour. Furthermore, in contrast to MST and TSP, computation of -NN can be easily parallelized. Secondly, for different values of , MST and TSP need to be recomputed since the distance between two points is the -th power of their Euclidean distance where . However, the -NN graph does not change for different values of , since -th power is a monotone transformation, and hence the estimates for multiple values of can be calculated without the extra penalty incurred by the recomputation of the graph. This can be advantageous e.g. in intrinsic dimension estimators of manifolds (Costa and Hero, 2003), where is a free parameter, and thus one can calculate the estimates efficiently for a few different parameter values.
The fourth major contribution is a proof of a finite-sample high-probability error bound (i.e. the rate of convergence) for our mutual information estimator which holds under the assumption that the copula of is Lipschitz. According to the best of our knowledge, this is the first result that gives a rate for the estimation of Rényi mutual information.
The toolkit for proving our results derives from the deep literature of Euclidean functionals, see, (Steele, 1997; Yukich, 1998). In particular, our strong consistency result uses a theorem due to Redmond and Yukich (1996) that essentially states that any quasi-additive power-weighted Euclidean functional can be used as a strongly consistent estimator of Rényi entropy (see also Hero and Michel 1999). We also make use of a result due to Koo and Lee (2007), who proved a rate of convergence result that holds under more stringent conditions. Thus, the main thrust of the present work is showing that these conditions hold for -power weighted nearest-neighbor graphs. Curiously enough, up to now, no one has shown this, except for the case when , which is studied in Section 8.3 of (Yukich, 1998). However, the condition gives results only for .
All proofs and supporting lemmas can be found in the appendix. In the main body of the paper, we focus on clear explanation of Rényi entropy and mutual information estimation problems, the estimation algorithms and the statements of our converge results.
Additionally, we report on two numerical experiments. In the first experiment, we compare the empirical rates of convergence of our estimators with our theoretical results and plug-in estimates. Empirically, the NN methods are the clear winner. The second experiment is an illustrative application of mutual information estimation to an Independent Subspace Analysis (ISA) task.
The paper is organized as follows: In the next section, we formally define Rényi entropy and Rényi mutual information and the problem of their estimation. Section 3 explains the ‘generalized nearest neighbor’ graphs. This graph is then used in Section 4 to define our Rényi entropy estimator. In the same section, we state a theorem containing our convergence results for this estimator (strong consistency and rates). In Section 5, we explain the copula transformation, which connects Rényi entropy with Rényi mutual information. The copula transformation together with the Rényi entropy estimator from Section 4 is used to build an estimator of Rényi mutual information. We conclude this section with a theorem stating the convergence properties of the estimator (strong consistency and rates). Section 6 contains the numerical experiments. We conclude the paper by a detailed discussion of further related work in Section 7, and a list of open problems and directions for future research in Section 8.
The Formal Definition of the Problem
For they are defined by the limits and . In fact, Shannon (differential) entropy and the Shannon mutual information are just special cases of Rényi entropy and Rényi mutual information with .
Generalized Nearest-Neighbor Graphs
The basic tool to define our estimators is the generalized nearest-neighbor graph and more specifically the sum of the -th powers of Euclidean lengths of its edges.
For let us denote by the sum of the -th powers of Euclidean lengths of its edges. Formally,
where denotes the edge set of . We intentionally hide the dependence on in the notation . For the rest of the paper, the reader should think of as a fixed but otherwise arbitrary finite non-empty set of integers, say, .
The following is a basic result about . The proof can be found in the appendix.
Let be an i.i.d. sample from the uniform distribution over the -dimensional unit cube . For any and any finite non-empty set of positive integers there exists a constant such that
The value of depends on and, except for special cases, an analytical formula for its value is not known. This causes a minor problem since the constant appears in our estimators. A simple and effective way to deal with this problem is to generate a large i.i.d. sample from the uniform distribution over and estimate by the empirical value of .
An Estimator of Rényi Entropy
The following theorem is our main result about the estimator . It states that is strongly consistent and gives upper bounds on the rate of convergence. The proof of theorem is in the appendix.
Moreover, if is Lipschitz then for any with probability at least ,
Copulas and Estimator of Mutual Information
A particularly clever choice is for all , where is the cumulative distribution function (c.d.f.) of . With this choice, the marginal distribution of is the uniform distribution over $F_{j}X^{j}H_{\alpha}I_{\alpha}$ we see that
In other words, calculation of mutual information can be reduced to the calculation of entropy provided that marginal c.d.f.’s are known. The problem is, of course, that these are not known and need to be estimated from the sample. We will use empirical c.d.f.’s as their estimates. Given an i.i.d. sample from distribution and with density , the empirical c.d.f’s are defined as
Let us call the maps , the copula transformation, and the empirical copula transformation, respectively. The joint distribution of is called the copula of , and the sample is called the empirical copula (Dedecker et al., 2007). Note that -th coordinate of equals
where is the number of element of less than or equal to . Also, observe that the random variables are not even independent! Nonetheless, the empirical copula is a good approximation of an i.i.d. sample from the copula of . Hence, we estimate the Rényi mutual information by
where is defined by (5). The following theorem is our main result about the estimator . It states that is strongly consistent and gives upper bounds on the rate of convergence. The proof of this theorem can be found in the appendix.
Moreover, if the density of the copula of is Lipschitz, then for any with probability at least ,
Experiments
In this section we show two numerical experiments to support our theoretical results about the convergence rates, and to demonstrate the applicability of the proposed Rényi mutual information estimator, .
In our first experiment (Fig. 1), we demonstrate that the derived rate is indeed an upper bound on the convergence rate. Figure 1a-1c show the estimation error of as a function of the sample size. Here, the underlying distribution was a 3D uniform, a 3D Gaussian, and a 20D Gaussian with randomly chosen nontrivial covariance matrices, respectively. In these experiments was set to . For the estimation we used (kth) and (knn) sets. Our results also indicate that these estimators achieve better performances than the histogram based plug-in estimators (hist). The number and the sizes of the bins were determined with the rule of Scott (1979). The histogram based estimator is not shown in the 20D case, as in this large dimension it is not applicable in practice. The figures are based on averaging 25 independent runs, and they also show the theoretical upper bound (Theoretical) on the rate derived in Theorem 3. It can be seen that the theoretical rates are rather conservative. We think that this is because the theory allows for quite irregular densities, while the densities considered in this experiment are very nice.
2 Application to Independent Subspace Analysis
Further Related Works
As it was pointed out earlier, in this paper we heavily built on the results known from the theory of Euclidean functionals (Steele, 1997; Redmond and Yukich, 1996; Koo and Lee, 2007). However, now we can be more precise about earlier work concerning nearest-neighbor based Euclidean functionals: The closest to our work is Section 8.3 of Yukich (1998), where the case of graph based -power weighted Euclidean functionals with and was investigated.
Nearest-neighbor graphs have first been proposed for Shannon entropy estimation by Kozachenko and Leonenko (1987). In particular, in the mentioned work only the case of graphs with was considered. More recently, Goria et al. (2005) generalized this approach to and proved the resulting estimator’s weak consistency under some conditions on the density. The estimator in this paper has a form quite similar to that of ours:
Here stands for the digamma function, and is the directed edge pointing from to its nearest-neighbor. Comparing this with (5), unsurprisingly, we find that the main difference is the use of the logarithm function instead of and the different normalization. As mentioned before, Leonenko et al. (2008) proposed an estimator that uses the graph with for the purpose of estimating the Rényi entropy. Their estimator takes the form
where stands for the Gamma function, and is the volume of the -dimensional unit ball, and again is the directed edge in the graph starting from node and pointing to the -th nearest node. Comparing this estimator with (5), it is apparent that it is (essentially) a special case of our based estimator. From the results of Leonenko et al. (2008) it is obvious that the constant in (5) can be found in analytical form when . However, we kindly warn the reader again that the proofs of these last three cited articles (Kozachenko and Leonenko, 1987; Goria et al., 2005; Leonenko et al., 2008) contain a few errors, just like the Wang et al. (2009b) paper for KL divergence estimation from two samples. Kraskov et al. (2004) also proposed a -nearest-neighbors based estimator for the Shannon mutual information estimation, but the theoretical properties of their estimator are unknown.
Conclusions and Open Problems
We have studied Rényi entropy and mutual information estimators based on graphs. The estimators were shown to be strongly consistent. In addition, we derived upper bounds on their convergence rate under some technical conditions. Several open problems remain unanswered:
Our method can be used for estimation of Shannon entropy and mutual information by simply using close to . The open problem is to come up with a way of choosing , approaching , as a function of the sample size (and ) such that the resulting estimator is consistent and converges as rapidly as possible. An alternative is to use the logarithm function in place of the power function. However, the theory would need to be changed significantly to show that the resulting estimator remains strongly consistent.
In the proof of consistency of our mutual information estimator we used Kiefer-Dvoretzky-Wolfowitz theorem to handle the effect of the inaccuracy of the empirical copula transformation. Our particular use of the theorem seems to restrict to the interval and the dimension to values larger than . Is there a better way to estimate the error caused by the empirical copula transformation and prove consistency of the estimator for a larger range of ’s and ?
Finally, it is an important open problem to prove bounds on converge rates for densities that have higher order smoothness (i.e. -Hölder smooth densities). A related open problem, in the context of of theory of Euclidean functionals, is stated in Koo and Lee (2007).
Acknowledgements
This work was supported in part by AICML, AITF (formerly iCore and AIF), NSERC, the PASCAL2 Network of Excellence under EC grant no. 216886 and by the Department of Energy under grant number DESC0002607. Cs. Szepesvári is on leave from SZTAKI, Hungary.
References
Appendix A Quasi-Additive and Very Strong Euclidean Functionals
The basic tool to prove convergence properties of our estimators is the theory of quasi-additive Euclidean functionals developed by Yukich (1998); Steele (1997); Redmond and Yukich (1996); Koo and Lee (2007) and others. We apply this machinery to the nearest neighbor functional defined in equation (3).
is a quasi-additive Euclidean functional of power if it satisfies axioms (A1)–(A7) below.
is a very strong Euclidean functional of power if it satisfies axioms (A1)–(A9) below.
For all and a partition of into subcubes of side
For all finite ,
For a set of points drawn i.i.d. from the uniform distribution over ,
Axiom (A2) is translation invariance, axiom (A3) is scaling. First part of (A5) is subadditivity of and second part is super-additivity of . Axiom (A6) is smoothness and we call (A7) quasi-additivity. Axiom (A8) is a strengthening of (A7) with an explicit rate. Axiom (A9) is the add-one bound. The axioms in Koo and Lee (2007) are slightly different, however it is a routine to check that they are implied by our set of axioms.
We will use two fundamental results about Euclidean functionals. The first is (Redmond and Yukich, 1996, Theorem 2.2) and the second is essentially (Koo and Lee, 2007, Theorem 4).
where is a constant depending only on the functional and .
where is the constant from Theorem 6.
Theorem 7 differs from its original statement (Koo and Lee, 2007, Theorem 4) in two ways. First, our version is restricted to Lipschitz densities. Koo and Lee prove a generalization of Theorem 7 for -Hölder smooth density functions. The coefficient then appears in the exponent of in the rate. However, their result holds only for in the interval which does not make it very interesting. The case corresponds to Lipschitz densities and is perhaps the most important in this range. Second, Theorem 7 has slight improvement in the rate. Koo and Lee have an extraneous factor which we remove by “correcting” their axiom (A8).
In the next section, we prove that the nearest neighbor functional defined by (3) is a very strong Euclidean functional. First, in section B, we provide a boundary functional for . Then, in section C, we verify that satisfy axioms (A1)–(A9). Once the verification is done, Theorem 1 follows from Theorem 6.
Theorem 2 will follow from Theorem 7 and a concentration result. We prove the concentration result in Section D and finish that section with the proof of Theorem 2. Proof of Theorem 3 requires more work—we need to deal with the effect of empirical copula transformation. We handle this in Section E by employing the classical Kiefer-Dvoretzky-Wolfowitz theorem.
We start by constructing the nearest neighbor boundary functional . For that we will need to introduce an auxiliary graph, which we call the nearest-neighbor graph with boundary. This graph is related to and will be useful later.
More precisely, we define the edges from as follows: Let be the boundary point closest to . (If there are multiple boundary points that are the closest to we choose one arbitrarily.) If and then also belongs to . For each such that we create in one copy of the edge . In other words, there is a bijection between edge sets and . An example of a graph and a corresponding graph are shown in Figure 3.
Analogously, we define as the sum of -powered edges of . Formally,
We will need some basic geometric properties of and . By construction, the edges of are shorter than the corresponding edges of . As an immediate consequence we get the following proposition.
For any cube , any and any finite set , .
It is easy to see that the nearest neighbor functional and its boundary functional satisfy axioms (A1)–(A3). Axiom (A4) is verified by Proposition 8. It thus remains to verify axioms (A5)–(A9) which we do in subsections C.1, C.2 and C.3. We start with two simple lemmas.
Suppose, by contradiction, that the in-degree of is larger than . Then, by pigeonhole principle, there is a cone containing vertices of the graph with an incoming edge to . Denote these vertices and assume that they are indexed so that .
By a simple calculation, we can verify that for all . Indeed, by the law of cosines
where the sharp inequality follows from that and so the angle between vectors and is strictly less than , and the second inequality follows from . Thus, cannot be among the nearest-neighbors of which contradicts the existence of the edge . ∎
For any and finite , .
An elegant way to prove the lemma is with the use of space-filling curves.There is an elementary proof, too, based on a discretization argument. However, this proof introduces an extraneous logarithmic factor when . Since Peano (1890) and Hilbert (1891), it is known that there exists a continuous function from the unit interval $^{d}\bm{\psi}(1/d)C>0$ such that
Since is a surjective function we can consider a right inverse i.e. a function such that and we let . Let be the points of sorted in the increasing order. We construct a “nearest neighbor” graph on . For every and every we create a directed edge , where the addition is taken modulo . It is not hard to see that the total length of the edges of is
To see more clearly why (15) holds, note that every line segment , belongs to at most edges and the total length of the line segments is .
Let be a graph on isomorphic to , where for each edge there is a corresponding edge . By the construction of
Hölder property of implies that
If then since and thus
Chaining the last inequality with (16), (17) and (15) we obtain that for .
If we use the inequality between arithmetic and -mean. It states that for positive numbers
In our case ’s are the edge length of and , and we have
Combining the last inequality with (16), (17) and (15) we get that for .
Finally, for , . ∎
For and finite disjoint , .
For the lemma trivially follows from the growth bound , . For , we need to prove two inequalities:
We start with the first inequality. We use the obvious property of that . Combined with the growth bound (Lemma 10) for we get
Let be the set of vertices such that in there exists an edge from to a vertex . Using the two observations and the growth bound we have
The term is can be upper bounded by since by the choice of the graph is a subgraph of . The term is at most since is upper bounded by the number of edges of ending in and, in turn, the number of these edges is by the in-degree lemma at most . ∎
For and finite ,
where denotes the symmetric difference.
For and finite disjoint ,
The proof of the lemma is identical to the proof of Lemma 11 if we replace by , by , by and by . We, of course, need to explain what and mean. For , we define as the subgraph of , where the edges starting in are removed, and is the sum the -th powers of Euclidean lengths of edges of . ∎
For and finite ,
where denotes the symmetric difference.
The corollary is proved in exactly the same way as Corollary 12, where is replaced by . ∎
C.2 Subadditivity and Superadditivity
Consider a subcube which contains at least points. Using the “ notation” from the proof of Lemma 11
Let be the union subcubes that contain at most points. Clearly . Then
where we have used the second part of (18). The proof is finished by applying the growth bound . ∎
We construct a new graph by modifying the graph . Consider any edge such that and for some . Let be the point where and the line segment from to intersect. In , we replace by . Note that the all edges of lie completely in one of the subcubes and they are shorter or equal to the corresponding edges in .
Let be the sum of -th powers of the Euclidean length of the edges of lying in . Since edges in are shorter than in , . To finish the proof it remains to show that for all .
For any edge in from to , the point is not necessarily the closest to . Therefore, any edge in is shorter than the corresponding edge in . ∎
C.3 Uniformly Distributed Points
Axiom (A7) is a direct consequence of axiom (A8). Hence, we are left with verifying axioms (A8) and (A9). In this section, denotes a set of points chosen independently uniformly at random from .
Assume are chosen i.i.d. uniformly at random from . Let be a fixed positive integer. Let be the distance from to -th nearest-neighbor in . For any ,
The last inequality follows from the obvious bound and that for the intersection contains a cube of side at least . To simplify this complicated integral, we note that and make substitution . The last integral can be bounded by a constant multiple of
Since and the sum consists of only constant number of terms, it remains to show that the inner integral is . We can express the inner integral using the gamma function. Then, we use the asymptotic relation for generalized binomial coefficients to upper-bound the result:
Let be i.i.d. points from the uniform distribution over . We couple and in the obvious way and . Let be the distance from to -th closest neighbor in . The inequality
holds since accounts for the edges from and since the edges from are shorter (or equal) in than the corresponding edges in . Taking expectations and using Lemma 17 we get
To show the other direction of the inequality, let be the distance from its -the nearest point in . (Recall that .) Let be the incoming neighborhood of . Now if we remove from , the vertices in lose as their neighbor and they need to be connected to a new neighbor in . This neighbor is not farther than their -th nearest-neighbor in . Therefore,
Summing over all we have
The double sum on the right hand side is simply the sum over all edges of and so we can write
The proof is finished by dividing through by . ∎
The first inequality follows from Proposition 8 by taking expectation. The proof of the second inequality is much more involved. Consider the (random) subset of points which are connected to the boundary in by at least one edge. We use the notation for any and its two properties expressed by Eq. (18) and a third obvious property . We have
where in the last step we have used that which holds since the edges from vertices are the same in both graphs and . If we take expectation, we get
The second key component that we need is that the expected sum of -th powers of lengths of edges of that connect points in to is “small”. More precisely, for any point let be the boundary point closest to . We show that
If then . Therefore, for any
We construct a nearest-neighbor graph on by lifting . For every edge, in we create an edge . Clearly, is at most the sum of -the powers of the edges lengths of . By triangle inequality, for any
In-degrees and out-degrees of are and so if we sum over all edges of of and take expectation, we get
Appendix D Concentration and Estimator of Entropy
In this section, we show that if is a set of points drawn i.i.d. from any distribution over then is tightly concentrated. That is, we show that with high probability is within its expected value. We use this result at the end of this section to give a proof of Theorem 2.
It turns out that in order to derive the concentration result, the properties of the distribution generating the points are irrelevant (even the existence of density is not necessary). The only property that we exploit is smoothness of . As a technical tool, we use the isoperimetric inequality for Hamming distance and product measures. This inequality is, in turn, a simple consequence of Talagrand’s isoperimetric inequality, see e.g. Dubhashi and Panconesi (2009); Alon and Spencer (2000); Talagrand (1995). To phrase the isoperimetric inequality, we use Hamming distance between two tuples , which is defined as the number of elements in which and disagree.
Let be a subset of an -fold product of a probability space equipped with a product measure. For any let be an expansion of . Then, for any ,
where denotes the complement of with respect to .
Let consists of points drawn i.i.d. from an absolutely continuous probability distribution over , let . For any ,
where denotes the median of a random variable.
Let and , where are independent. To emphasize that we are working in a product space, we use the notations , and . Let . By smoothness of there exists a constant such that
Therefore, implies that . Hence for a random
by the isoperimetric inequality. Similarly, we set and note that by smoothness we have also the reversed inequality
Therefore, implies that . By the same argument as before
The theorem follows by the union bound and the fact that . ∎
For conciseness let and . We have
Putting these pieces together we arrive at what we wanted to prove:
By scaling and translation, we can assume that the support of is contained in the unit cube . The first part of the theorem follows immediately from Theorem 6. To prove the second part observe from (23) that for any with probability at least ,
It is easy to see that if then , and if then . Now using (24), Theorem 7 and the triangle inequality, we have that for any with probability at least ,
To finish the proof of (7) exploit the fact that for . ∎
Appendix E Copulas and Estimator of Mutual Information
The goal of this section is to prove Theorem 3 on convergence of the estimator . The main additional problem that we need to deal with in the proof is the effect of the empirical copula transformation. A version of the classical Kiefer-Dvoretzky-Wolfowitz theorem due to Massart gives a convenient way to do it; see e.g. Devroye and Lugosi (2001).
As a simple consequence of the Kiefer-Dvoretzky-Wolfowitz theorem, we can derive that is a good approximation of .
The following corollary is an obvious consequence of this lemma:
Let and be real numbers. Let and be the same numbers sorted in ascending order. Then, , for all .
The proof is left as an exercise for the reader. ∎
Let , and . Let and be the edge weights defined by and respectively. Let be the -th power of the distance from to its -th nearest-neighbor in , for ,. Similarly, let be the -th power of the distance from to its -th nearest-neighbor in . Note that for any , if we sort the real numbers , then we get . Similarly for ’s and ’s. Using these notations we can write
The third inequality follows from Proposition 27. It remains to bound . We consider two cases:
Case . Using valid for any and the triangle inequality
Case . Consider the function on interval . On this interval and so is Lipschitz with constant . In other words, for any , . Thus
where the second inequality follows from (26). ∎
It follows immediately from Corollary 26 and Lemma 28 that with probability at least ,
We are now ready to give the proof of Theorem 3.
Let denote the density of the copula of . The first part follows from (6), Corollary 29 and a standard Borel-Cantelli argument with . Corollary 29 puts the restrictions and .
The second part can be proved along the same lines. From (7) we have that for any with probability at least ,
Hence using the triangle inequality again, and exploiting that if , , we have that with probability at least ,
To finish the proof exploit that when then . ∎