Estimating Mutual Information for Discrete-Continuous Mixtures
Weihao Gao, Sreeram Kannan, Sewoong Oh, Pramod Viswanath
Introduction
A fundamental quantity of interest in machine learning is mutual information (MI), which characterizes the shared information between a pair of random variables . MI obeys several appealing properties including the data-processing inequality, invariance under one-to-one transformations and the chain rule , which led to a wide use in canonical tasks such as classification , clustering and feature selection . Mutual information also emerges as the “correct” quantity in several graphical model inference problems (e.g., the Chow-Liu tree and conditional independence testing ). MI is also pervasively used in many data science application domains, such as sociology , computational biology , and computational neuroscience .
An important problem in any of these applications is to estimate mutual information effectively from samples. While mutual information has been the de facto measure of information in several applications for decades, the estimation of mutual information from samples remains an active research problem. Recently, there has been a resurgence of interest in entropy and mutual information estimators, on both the theoretical as well as practical fronts .
The previous estimators focus on either of two cases – the data is either purely discrete or purely continuous. In these special cases, the mutual information can be calculated based on the three (differential) entropies of , and . We term estimators based on this principle as -estimators (since they estimate three entropy terms), and a majority of previous estimators fall under this category .
In practical downstream applications, we often have to deal with a mixture of continuous and discrete random variables. Random variables can be mixed in several ways. First, one random variable can be discrete whereas the other is continuous. For example, we want to measure the strength of relationship between children’s age and height, here age is discrete and height is continuous. Secondly, a single scalar random variable itself can be a mixture of discrete and continuous components. For example, consider taking a zero-inflated-Gaussian distribution, which takes value with probability and is a Gaussian distribution with mean with probability . This distribution has both a discrete component as well as a component with density. Finally, and / or can be high dimensional vector, each of whose components may be discrete, continuous or mixed.
Problem Formation
In this section, we define mutual information for general distributions as follows (e.g., ).
Let be a probability measure on the space , where and are both Euclidean spaces. For any measurable set and , define and . Let be the product measure . If is absolutely continuous w.r.t. , then the mutual information of is defined as
where is the Radon-Nikodym derivative.
Notice that this general definition includes the following cases of mixtures: (1) is discrete and is continuous (or vice versa); (2) or has many components each, where some components are discrete and some are continuous; (3) or or their joint distribution is a mixture of continuous and discrete distributions.
Estimators of Mutual Information
The estimation problem is quite different depending on whether the underlying distribution is discrete, continuous or mixed. As pointed out earlier, most existing estimators for mutual information are based on the principle: they estimate the three entropy terms first. This principle can be applied only in the purely discrete or purely continuous case.
Discrete data: For entropy estimation of a discrete variable , the straightforward approach to plug-in the estimated probabilities into the formula for entropy has been shown to be suboptimal . Novel entropy estimators with sub-linear sample complexity have been proposed . MI estimation can then be performed using the principle, and such an approach is shown to be worst-case optimal for mutual-information estimation .
Continuous data: There are several estimators for differential entropy of continuous random variables, which have been exploited in a principle to calculate the mutual information . One family of entropy estimators are based on kernel density estimators followed by re-substitution estimation. An alternate family of entropy estimators is based on -Nearest Neighbor (-NN) estimates, beginning with the pioneering work of Kozachenko and Leonenko (the so-called KL estimator). Recent progress involves an inspired mixture of an ensemble of kernel and -NN estimators . Exponential concentration bounds under certain conditions are in .
Mixed Random Variables: Since the entropies themselves may not be well defined for mixed random variables, there is no direct way to apply the principle. However, once the data is quantized, this principle can be applied in the discrete domain. That mutual information in arbitrary measure spaces can indeed be computed as a maximum over quantization is a classical result . However, the choice of quantization is complicated and while some quantization schemes are known to be consistent when there is a joint density , the mixed case is complex. Estimator of the average of Radon-Nikodym derivative has been studied in . Very recent work generalizing the ensemble entropy estimator when some components are discrete and others continuous is in .
Beyond estimation: In an inspired work proposed a direct method for estimating mutual information (KSG estimator) when the variables have a joint density. The estimator starts with the estimator based on differential entropy estimates based on the -NN estimates, and employs a heuristic to couple the estimates in order to improve the estimator. While the original paper did not contain any theoretical proof, even of consistency, its excellent practical performance has encouraged widespread adoption. Recent work has established the consistency of this estimator along with its convergence rate. Further, recent works involving a combination of kernel density estimators and -NN methods have been proposed to further improve the KSG estimator. extends the KSG estimator to the case when one variable is discrete and another is scalar continuous.
None of these works consider a case even if one of the components has a mixture of continuous and discrete distribution, let alone for general probability distributions. There are two generic options: (1) one can add small independent noise on each sample to break the multiple samples and apply a continuous valued MI estimator (like KSG), or (2) quantize and apply discrete MI estimators but the performance for high-dimensional case is poor. These form baselines to compare against in our detailed simulations.
2 Mixed Regime
We first examine the behavior of other estimators in the mixed regime, before proceeding to develop our estimator. Let us consider the case when is discrete (but real valued) and possesses a density. In this case, we will examine the consequence of using the principle, with differential entropy estimated by the -nearest neighbors. To do this, fix a parameter , that determines the number of neighbors and let , and denote the distance of the -nearest neighbor of , and , respectively. Then
where is the digamma function and . In the case that is discrete and has a density, , which is clearly wrong.
The basic idea of the KSG estimator is to ensure that the is the same for both , and and the difference is instead in the number of nearest neighbors. Let be the number of samples of ’s within distance and be the number of samples of ’s within distance . Then the KSG estimator is given by where is the digamma function.
In the case of being discrete and being continuous, it turns out that the KSG estimator does not blow up (unlike the estimator), since the distances do not go to zero. However, in the mixed case, the estimator has a non-trivial bias due to discrete points and is no longer consistent.
3 Proposed Estimator
We propose the following estimator for general probability distributions, inspired by the KSG estimator. The intuition is as follows. First notice that MI is the average of the logarithm of Radon-Nikodym derivative, so we compute the Radon-Nikodym derivative for each sample and take the empirical average. The re-substitution estimator for MI is then given as follows: The basic idea behind our estimate of the Radon-Nikodym derivative at each sample point is as follows:
When the point is discrete (which can be detected by checking if the -nearest neighbor distance of data is zero), then we can assert that data is in a discrete component, and we can use plug-in estimator for Radon-Nikodym derivative.
If the point is such that there is a joint density (locally), the KSG estimator suggests a natural idea: fix the radius and estimate the Radon-Nikodym derivative by .
If -nearest neighbor distance is not zero, then it may be either purely continuous or mixed. But we show below that the method for purely continuous is also applicable for mixed.
Proof of Consistency
We show that under certain technical conditions on the joint probability measure, the proposed estimator is consistent. We begin with the following definitions. Let denote the Radon-Nikodym derivative and define
is chosen to be a function of such that and as .
The set of discrete points is finite.
\int_{\mathcal{X}\times\mathcal{Y}}\big{|}\,\log\frac{dP_{XY}}{dP_{X}P_{Y}}\,\big{|}\,dP_{XY}<+\infty.
Notice that the assumptions are satisfied whenever (1) the distribution is (finitely) discrete; (2) the distribution is continuous; (3) some dimensions are (countably) discrete and some dimensions are continuous; (4) a (finite) mixture of the previous cases. Most real world data can be covered by these cases. A sketch of the proof is below with the full proof in the supplementary material.
(Sketch) We start with an explicit form of the Radon-Nikodym derivative .
For almost every , we have
For , it can be viewed as a continuous part. We use the similar proof technique as to prove that the mean of estimate is closed to .
The following theorem bounds the variance of the proposed estimator.
as .
(Sketch) We use the Efron-Stein inequality to bound the variance of the estimator. For simplicity, let be the estimate based on original samples , where , and is the estimate from . Then a certain version of Efron-Stein inequality states that: {\textrm{ Var }}\left[\,\widehat{I}^{(N)}(Z)\,\right]\leq 2\sum_{j=1}^{N}\left(\,\sup_{Z_{1},\dots,Z_{N}}\Big{|}\,\widehat{I}^{(N)}(Z)-\widehat{I}^{(N)}(Z_{\setminus j})\,\Big{|}\,\right)^{2}\;. Now recall that
To upper bound the difference created by eliminating sample for different ’s we consider three different cases: (1) ; (2) ; (3) , and conclude that for all ’s. The detail of the case study is in Section. B in the supplementary material. Plug it into Efron-Stein inequality, we obtain:
By Assumption 6, we have . ∎
Simulations
We evaluate the performance of our estimator in a variety of (synthetic and real-world) experiments.
Experiment I. is a mixture of one continuous distribution and one discrete distribution. The continuous distribution is jointly Gaussian with zero mean and covariance , and the discrete distribution is and . These two distributions are mixed with equal probability. The scatter plot of a set of samples from this distribution is shown in the left panel of Figure. 1, where the red squares denote multiple samples from the discrete distribution. For all synthetic experiments, we compare our proposed estimator with a (fixed) partitioning estimator, an adaptive partitioning estimator implemented by , the KSG estimator and noisy KSG estimator (by adding Gaussian noise on each sample to transform all mixed distributions into continuous one). We plot the mean squared error versus number of samples in Figure 2. The mean squared error is averaged over 250 independent trials.
The KSG estimator is entirely misled by the discrete samples as expected. The noisy KSG estimator performs better but the added noise causes the estimate to degrade. In this experiment, the estimate is less sensitive to the noise added and the line is indistinguishable with the line for KSG. The partitioning and adaptive partitioning method quantizes all samples, resulting in an extra quantization error. Note that only the proposed estimator has error decreasing with the sample size.
Experiment II. is a discrete random variable and is a continuous random variable. is uniformly distributed over integers and is uniformly distributed over the range for a given . The ground truth . We choose and a scatter plot of a set of samples is in the right panel of Figure. 1. Notice that in this case (and the following experiments) our proposed estimator degenerates to KSG if the hyper parameter is chosen the same, hence KSG is not plotted. In this experiment our proposed estimator outperforms other methods.
Experiment III. Higher dimensional mixture. Let and have the same joint distribution as in experiment II and independent of each other. We evaluate the mutual information between and . Then ground truth . We also consider and where have the same joint distribution as in experiment II and independent of . The ground truth . The adaptive partitioning algorithm works only for one-dimensional and and is not compared here.
We can see that the performance of partitioning estimator is very bad because the number of partitions grows exponentially with dimension. Proposed algorithm suffers less from the curse of dimensionality. For the right figure, noisy KSG method has smaller error, but we point out that it is unstable with respect to the noise level added: as the noise level is varied from to and the performance varies significantly (far from convergence).
Experiment IV. Zero-inflated Poissonization. Here is a standard exponential random variable, and is zero-inflated Poissonization of , i.e., with probability and given with probability . Here the ground truth is , where is Euler-Mascheroni constant. We repeat the experiment for no zero-inflation () and for . We find that the proposed estimator is comparable to adaptive partitioning for no zero-inflation and outperforms others for 15% zero-inflation.
We conclude that our proposed estimator is consistent for all these four experiments, and the mean squared error is always the best or comparable to the best. Other estimators are either not consistent or have large mean squared error for at least one experiment.
Gene regulatory network inference. Gene expressions form a rich source of data from which to infer gene regulatory networks; it is now possible to sequence gene expression data from single cells using a technology called single-cell RNA-sequencing . However, this technology has a problem called dropout, which implies that sometimes, even when the gene is present it is not sequenced . While we tested our algorithm on real single-cell RNA-seq dataset, it is hard to establish the ground truth on these datasets. Instead we resorted to a challenge dataset for reconstructing regulatory networks, called the DREAM5 challenge . The simulated (insilico) version of this dataset contains gene expression for 20 genes with 660 data point containing various perturbations. The goal is to reconstruct the true network between the various genes. We used mutual information as the test statistic in order to obtain AUROC for various methods. While the dataset did not have any dropouts, in order to simulate the effect of dropouts in real data, we simulated various levels of dropout and compared the AUROC (area under ROC) of different algorithms in the right of Figure 3 where we find the proposed algorithm to outperform the competing ones.
Acknowledgement
We thank Arman Rahimzamani and Himanshu Asnani for their constructive comments on the proofs of the lemmas, especially for the proof of Lemma A.2.
Appendix
Appendix A Proof of Theorem 1
To prove the asymptotic unbiasedness of the estimator, we need to write the Radon-Nikodym derivative in an explicit form. The following lemma gives the explicit form of .
For almost every , .
: In this case, we will show that has zero probability with respect to .
First, the probability of is upper bounded by:
If is distributed as and , then:
By Assumption 2, as , then , So for sufficiently large , the RHS of Lemma A.2 is upper bounded by , where is some constant not depends on . Therefore, by applying Lemma A.2 with , the first term of (14) is bounded by:
Combine with the case that , we obtain that:
where the first term comes from triangle inequality and the fact that . Integrating over , we have:
where denotes counting measure. By Assumption 1, goes to infinity as goes to infinity, so vanishes as increases. By Assumption 1 and 2, goes to 0 and has finite counting measure, so the second term also vanishes. Since has finite counting measure, so . By Assumption 3, . Therefore, for sufficiently large , the first term also vanishes. Therefore,
: In this case, is a monotonic function of such that and . Hence, we can view as a function of , and it converges to as , for almost every . Since and . Then by Egoroff’s Theorem, for any , there exists a subset with and , such that converges as , uniformly on . For , notice that , so we have:
here is the CDF of the -nearest neighbor distance , given . By results of order statistics, its derivative with respect to is given by:
Now we consider the four terms separately. For (25), since converges as , uniformly on . So for every , there exists an such that and for every . Here may depend on , but does not depend on and . Therefore, (25) is upper bounded by:
for sufficiently large such that . Therefore, (25) is upper bounded by
For (25), we simply plug in and integrate over and obtain
where we use the fact that . Notice that and .
Now we deal with (25) and (25). The following lemmas establish the distribution of and given and .
Given and , then is distributed as ; is distributed as .
The following lemma is useful to establish the upper bound for (25) and (25).
Now we are ready to upper bound (25). First, we rewrite the term (25) as:
For (32), by the fact that for all and Cauchy-Schwarz inequality, we have the following:
Notice that for all , so the second expectation is always no larger than 1. For the first expectation, we plug in and integrate over , let and observe,
For sufficiently large and , it is upper bounded by for some constant . Therefore,
Similarly, by using the fact that and Cauchy-Schwarz inequality again, we conclude that there are some constant such that
Therefore, by combining (33), (36) and (37), we obtain
where . Since (25) and (25) are symmetric, the same upper bound (38) also applies to (25). Combine (29), (30) and (38), we have
for every . By integration over , we have
By Assumption 1, increases as . By Assumption 3, . Therefore, this quantity vanishes as . Combining with the case that , we have
The proof of this lemma utilizes the Lebesgue-Besicovitch differentiation theorem [11, Theorem 1.32], stated below
For our lemma, let and . Since is a probability measure, it is a Radon measure of Euclidean space. Also, since , so is globally integrable, hence locally integrable with respect to . So the conditions of Lebesgue-Besicovitch differentiation theorem are satisfied, so
A.2 Proof of Lemma A.2
since , we have:
Now taking the conditional expectations from both sides, we have:
In which we used the fact that for , and for . Plugging it into Equation 60, we have:
A.3 Proof of Lemma A.3
Now we deal with the case that . Given that and , we sort the samples by their distance to defined as . To avoid the case that two samples have identical distance, we introduce a set of random variables i.i.d. samples from and define a comparison operator as:
Since for any , the probability that is zero, so we can have either or with probability 1. Now let be a partition of the indices with and . Define an event associated to the partition as:
A.4 Proof of Lemma A.4
(i) . In this case, for any , by applying Taylor’s theorem around , there exists between and such that
By noticing that , we have
Now let be a random variable. By taking expectation on both sides, we have:
for and . Plug these in (81), we have
where comes from the fact that .
(ii) . In this case, for any , by applying Taylor’s theorem around , there exists between and such that
By noticing that , we have:
Similarly, by taking expectation on both sides, we have
Combining the two cases, we obtain the desired statement.
Appendix B Proof of Theorem 2
We use the Efron-Stein inequality to bound the variance of the estimator. For simplicity, let be the estimate based on original samples , where . For the usage of Efron-Stein inequality, we consider another set of i.i.d. samples drawn from . Let be the estimate based on . Then Efron-Stein inequality states that
Now we will give an upper bound for the difference for given index . First of all, let be the estimate based on , then by triangle inequality, we have:
where the last equality comes from the fact that has the same joint distribution as . Now recall that
Now we need to upper-bound the difference created by eliminating sample for different ’s. There are three cases of ’s as follows,
Case I. . Since the upper bounds and always holds, so . The number of ’s in this case is only 1. So .
The number of ’s in this case is the number if ’s such that but , which is less than . Therefore, .
Combining the four sub-cases, we conclude that .
Case III.1. is in the -nearest neighbors of . In this case, we don’t know how and will change by eliminating , so we just use the loosest bound . However, the number of ’s in this case is upper bounded by the following lemma.
By the first inequality in Lemma B.1, the number of ’s in this case is upper bounded by . Therefore, .
Case III.2. is not in the -nearest neighbors of , but , i.e., is in the -nearest neighbors of . In this case, will decrease by 1 and remains the same. So
We don’t have an upper bound for the number of ’s in this case, but from the second inequality in Lemma B.1, we have the following upper bound, where :
Case III.3. is not in the -nearest neighbors of , but , i.e., is in the -nearest neighbors of . In this case, will decrease by 1 and remains the same. Follow the same analysis in Case III.2, we have as well.
Case III.4. is not in the -nearest neighbors of , and , . In this case, neither nor will change. Similar to Case II.4, .
Combining the four sub-cases, we conclude that .
for , and all . Plug it into (91), we obtain,
Plug it into Efron-Stein inequality (88), we obtain:
Since is a constant independent of , and as by Assumption 6, we have .
For the first part of the lemma, we refer to Lemma 20.6 in .
The second part of the lemma is a consequence of the first part. We reorder the indices ’s by and rewrite the summation as follows,