Breaking the Bandwidth Barrier: Geometrical Adaptive Entropy Estimation
Weihao Gao, Sewoong Oh, Pramod Viswanath
Introduction
Unsupervised representation learning is one of the major themes of modern data science; a common theme among the various approaches is to extract maximally “informative" features via information-theoretic metrics (entropy, mutual information and their variations) – the primary reason for the popularity of information theoretic measures is that they are invariant to one-to-one transformations and that they obey natural axioms such as data processing. Such an approach is evident in many applications, as varied as computational biology , sociology and information retrieval , with the citations representing a mere smattering of recent works. Within mainstream machine learning, a systematic effort at unsupervised clustering and hierarchical information extraction is conducted in recent works of . The basic workhorse in all these methods is the computation of mutual information (pairwise and multivariate) from i.i.d. samples. Indeed, sample-efficient estimation of mutual information emerges as the central scientific question of interest in a variety of applications, and is also of fundamental interest to statistics, machine learning and information theory communities.
While these estimation questions have been studied in the past three decades (and summarized in ), the renewed importance of estimating information theoretic measures in a sample-efficient manner is persuasively argued in a recent work , where the authors note that existing estimators perform poorly in several key scenarios of central interest (especially when the high dimensional random variables are strongly related to each other). The most common estimators (featured in scientific software packages) are nonparametric and involve nearest neighbor (NN) distances between the samples. The widely used estimator of mutual information is the one by Kraskov and Stögbauer and Grassberger and christened the KSG estimator (nomenclature based on the authors, cf. ) – while this estimator works well in practice (and performs much better than other approaches such as those based on kernel density estimation procedures), it still suffers in high dimensions. The basic issue is that the KSG estimator (and the underlying differential entropy estimator based on nearest neighbor distances by Kozachenko and Leonenko (KL) ) does not take advantage of the fact that the samples could lie in a smaller dimensional subspace (more generally, manifold) despite the high dimensionality of the data itself. Such lower dimensional structures effectively act as boundaries, causing the estimator to suffer from what is known as boundary biases.
Ameliorating this deficiency is the central theme of recent works , each of which aims to improve upon the classical KL (differential) entropy estimator of . A local SVD is used to heuristically improve the density estimate at each sample point in , while a local Gaussian density (with empirical mean and covariance weighted by NN distances) is heuristically used for the same purpose in . Both these approaches, while inspired and intuitive, come with no theoretical guarantees (even consistency) and from a practical perspective involve delicate choice of key hyper parameters. An effort towards a systematic study is initiated in which connects the aforementioned heuristic efforts of to the local log-likelihood density estimation methods from theoretical statistics.
The local density estimation method is a strong generalization of the traditional kernel density estimation methods, but requires a delicate normalization which necessitates the solution of certain integral equations (cf. Equation (9) of ). Indeed, such an elaborate numerical effort is one of the key impediments for the entropy estimator of to be practically valuable. A second key impediment is that theoretical guarantees (such as consistency) can only be provided when the bandwidth is chosen globally (leading to poor sample complexity in practice) and consistency requires the bandwidth to be chosen such that and , where is the sample size and is the dimension of the random variable of interest. More generally, it appears that a systematic application of local log-likelihood methods to estimate functionals of the unknown density from i.i.d. samples is missing in the theoretical statistics literature (despite local log-likelihood methods for regression and density estimation being standard textbook fare ). We resolve each of these deficiencies in this paper by undertaking a comprehensive study of estimating the (differential) entropy and mutual information from i.i.d. samples using sample dependent bandwidth choices (typically fixed -NN distances). This effort allows us to connect disparate threads of ideas from seemingly different arenas: NN methods, local log-likelihood methods, asymptotic order statistics and sample-dependent heuristic, but inspired, methods for mutual information estimation suggested in the work of .
Main Results: We make the following contributions.
Density estimation: Parameterizing the log density by a polynomial of degree , we derive simple closed form expressions for the local log-likelihood maximization problem for the cases of for arbitrary dimensions, with Gaussian kernel choices. This derivation, posed as an exercise in [20, Exercise 5.2], significantly improves the computational efficiency upon similar endeavors in the recent efforts of .
Entropy estimation: Using resubstitution of the local density estimate, we derive a simple closed form estimator of the entropy using a sample dependent bandwidth choice (of -NN distance, where is a fixed small integer independent of the sample size): this estimator outperforms state of the art entropy estimators in a variety of settings. Since the bandwidth is data dependent and vanishes too fast (because is fixed), the estimator has a bias, which we derive a closed form expression for and show that it is independent of the underlying distribution and hence can be easily corrected: this is our main theoretical contribution, and involves new theorems on asymptotic statistics of nearest neighbors generalizing classical work in probability theory , which might be of independent mathematical interest.
Generalized view: We show that seemingly very different approaches to entropy estimation – recent works of and the classical work of fixed -NN estimator of Kozachenko and Leonenko – can all be cast in the local log-likelihood framework as specific kernel and sample dependent bandwidth choices. This allows for a unified view, which we theoretically justify by showing that resubstitution entropy estimation for any kernel choice using fixed -NN distances as bandwidth involves a bias term that is independent of the underlying distribution (but depends on the specific choice of kernel and parametric density family). Thus our work is a strict mathematical generalization of the classical work of .
Mutual Information estimation: The inspired work of constructs a mutual information estimator that subtly altered (in a sample dependent way) the three KL entropy estimation terms, leading to superior empirical performance. We show that the underlying idea behind this change can be incorporated in our framework as well, leading to a novel mutual information estimator that combines the two ideas and outperforms state of the art estimators in a variety of settings.
In the rest of this paper we describe these main results, the sections organized in roughly the same order as the enumerated list.
Local likelihood density estimation (LLDE)
where maximization is over an exponential polynomial family, locally approximating near :
For higher degree local likelihood, we provide simple closed form solutions and provide a proof in Section 8.1. Somewhat surprisingly, this result has eluded prior works and which specifically attempted the evaluation for . Part of the subtlety in the result is to critically use the fact that the parametric family (eg., the polynomial family in (2)) need not be normalized themselves; the local log-likelihood maximization ensures that the resulting density estimate is correctly normalized so that it integrates to 1.
[20, Exercise 5.2] For a degree , the maximizer of local likelihood (1) admits a closed form solution, when using the Gaussian kernel . In case of ,
In case of , for and defined as above,
where it follows from Cauchy-Schwarz that is positive semidefinite.
One of the major drawbacks of the KDE and -NN methods is the increased bias near the boundaries. LLDE provides a principled approach to automatically correct for the boundary bias, which takes effect only for . This explains the performance improvement for in the figure below (left panel), and the gap increases with the correlation as boundary effect becomes more prominent. We use the proposed estimators with to estimate the mutual information between two jointly Gaussian random variables with correlation , from samples, using resubstitution methods explained in the next sections. Each point is averaged over instances.
In the right panel, we generate i.i.d. samples from a 2-dimensional Gaussian with correlation 0.9, and found local approximation around denoted by the blue in the center. Standard -NN approach fits a uniform distribution over a circle enclosing nearest neighbors (red circle). The green lines are the contours of the degree-2 polynomial approximation with bandwidth . The figure illustrates that -NN method suffers from boundary effect, where it underestimates the probability by over estimating the volume in (4). However, degree-2 LDDE is able to correctly capture the local structure of the pdf, correcting for boundary biases.
Despite the advantages of the LLDE, it requires the bandwidth to be data independent and vanishingly small (sublinearly in sample size) for consistency almost everywhere – both of these are impediments to practical use since there is no obvious systematic way of choosing these hyperparameters. On the other hand, if we restrict our focus to functionals of the density, then both these issues are resolved: this is the focus of the next section where we show that the bandwidth can be chosen to be based on fixed -NN distances and the resulting universal bias easily corrected.
k𝑘k-LNN Entropy Estimator
We consider resubstitution entropy estimators of the form and propose to use the local likelihood density estimator in (7) and a choice of bandwidth that is local (varying for each point ) and adaptive (based on the data). Concretely, we choose, for each sample point , the bandwidth to be the the distance to its -th nearest neighbor . Precisely, we propose the following -Local Nearest Neighbor (-LNN) entropy estimator of degree-:
The truncation is important for computational efficiency, but the analysis works as long as for any positive that can be arbitrarily small. For a larger , for example of , those neighbors that are further away have a different asymptotic behavior. We show in Theorem 1 that the asymptotic bias is independent of the underlying distribution and hence can be precomputed and removed, under mild conditions on a twice continuously differentiable pdf (cf. Lemma 3.1 below).
This proves the and consistency of the -LNN estimator; we relegate the proof to Section 10 for ease of reading the main part of the paper. The proof assumes Ansatz 1 (also stated in Section 10, which states that a certain exchange of limit holds. As noted in , such an assumption is common in the literature on consistency of -NN estimators, where it has been implicitly assumed in existing analyses of entropy estimators including , without explicitly stating that such assumptions are being made. Our choice of a local adaptive bandwidth is crucial in ensuring that the asymptotic bias does not depend on the underlying distribution . This relies on a fundamental connection to the theory of asymptotic order statistics made precise in Lemma 3.1, which also gives the explicit formula for the bias below.
In practice, we propose using a fixed small such as five. For the estimator has a very large variance, and numerical evaluation of the corresponding bias also converges slowly. For some typical choices of , we provide approximate evaluations below, where indicates empirical mean with confidence interval . In these numerical evaluations, we truncated the summation at . Although we prove that converges in , in practice, one can choose based on the number of samples and can be evaluated for that .
Empirical contribution: Numerical experiments suggest that the proposed estimator outperforms state-of-the-art entropy estimators, and the gap increases with correlation. The idea of using -NN distance as bandwidth for entropy estimation was originally proposed by Kozachenko and Leonenko in , and is a special case of the -LNN method we propose with degree and a step kernel. We refer to Section 4 for a formal comparison. Another popular resubstitution entropy estimator is to use KDE in (3) , which is a special case of the -LNN method with degree , and the Gaussian kernel is used in simulations. As comparison, we also study a new estimator based on von Mises expansion (as opposed to simple re-substitution) which has an improved convergence rate in the large sample regime. In Figure 2 (left), we draw samples i.i.d. from two standard Gaussian random variables with correlation , and plot resulting mean squared error averaged over instances. The ground truth, in this case is . On the right, we repeat the same simulation for fixed and varying number of samples and .
In Figure 3, we repeat the same simulation for 6 standard Gaussian random variables with and for other pairs . On the left, we draw i.i.d. samples with various . We plot resulting mean squared error averaged over instances. The ground truth is . On the right, we repeat the same simulation for fixed and varying number of samples and .
In Figure 4 (left), we draw samples i.i.d. from a mixture of two joint Gaussian distributions with zero mean and covariance and , respectively, and plot resulting average estimate over instances. Here we plot an upper bound of the ground truth for . On the right, we repeat the same simulation for fixed and varying number of samples and .
Universality of the k𝑘k-LNN approach
for some constant that only depends on and .
We provide a proof in Section 11. Although in general there is no simple analytical characterization of the asymptotic bias it can be readily numerically computed: since is independent of the underlying distribution, one can run the estimator over i.i.d. samples from any distribution and numerically approximate the bias for any choice of the parameters. However, when the maximization admits a closed form solution, as is the case with proposed -LNN, then can be characterized explicitly in terms of uniform order statistics.
k𝑘k-LNN Mutual information estimator
Given an entropy estimator , mutual information can be estimated: . In , Kraskov and Stögbauer and Grassberger introduced by coupling the choices of the bandwidths. The joint entropy is estimated in the usual way, but for the marginal entropy, instead of using NN distances from , the bandwidth is chosen, which is the nearest neighbor distance from for the joint data . Consider . Inspired by , we introduce the following novel mutual information estimator we denote by . where for the joint we use the LNN entropy estimator we proposed in (9), and for the marginal entropy we use the bandwidth coupled to the joint estimator. Empirically, we observe outperforms everywhere, validating the use of correlated bandwidths. However, the performance of is similar to –sometimes better and sometimes worse.
In Figure 5 (left), we estimate mutual information under the same setting as in Figure 2 (left). For most regimes of correlation , both 3LNN and LNN-KSG outperforms other state-of-the-art estimators. The gap increases with correlation . On the right, we draw i.i.d. samples from two random variables and , where is uniform over $Y=X+UU[0,0.01]X$. In the large sample limit, all estimators find the correct mutual information. The plot show how sensitive the estimates are, in the small sample regime. Both LNN and LNN-KSG are significantly more robust compared to other approaches. Mutual information estimators have been recently proposed in based on local likelihood maximization. However, they involve heuristic choices of hyper-parameters or solving elaborate optimization and numerical integrations, which are far from being easy to implement.
In Figure 6, we test the mutual information estimators for , where is uniformly distributed over $U[0,\theta]X\theta\theta{\widehat{I}}_{3LNN}{\widehat{I}}_{LNN-KSG}$ perform much better than 3KL and KSG estimators. Also our proposed estimators can handle both linear and nonlinear functional relationships.
In Figure 7, we test our estimators on linear and nonlinear relationships for both low-dimensional () and high-dimensional (). Here ’s are uniformly distributed over $U[-3^{8}/2,3^{8}/2]X_{i}{\widehat{I}}_{3LNN}{\widehat{I}}_{LNN-KSG}\hat{I}_{3KL}{\widehat{I}}_{KSG}$.
Breaking the bandwidth barrier
While -NN distance based bandwidth are routine in practical usage , the main finding of this work is that they also turn out to be the “correct" mathematical choice for the purpose of asymptotically unbiased estimation of an integral functional such as the entropy: ; we briefly discuss the ramifications below. Traditionally, when the goal is to estimate , it is well known that the bandwidth should satisfy and , for KDEs to be consistent. As a rule of thumb, is suggested when where is the sample standard deviation [41, Chapter 6.3]. On the other hand, when estimating entropy, as well as other integral functionals, it is known that resubstitution estimators of the form achieve variances scaling as independent of the bandwidth . This allows for a bandwidth as small as .
The bottleneck in choosing such a small bandwidth is the bias, scaling as , where the lower order dependence on , dubbed , is generally not known. The barrier in choosing a global bandwidth of is the strictly positive bias whose value depends on the unknown distribution and cannot be subtracted off. However, perhaps surprisingly, the proposed local and adaptive choice of the -NN distance admits an asymptotic bias that is independent of the unknown underlying distribution. Manually subtracting off the non-vanishing bias gives an asymptotically unbiased estimator, with a potentially faster convergence as numerically compared below. Figure 8 illustrates how -NN based bandwidth significantly improves upon, say a rule-of-thumb choice of explained above and another choice of . In the left figure, we use the setting from Figure 2 (right) but with correlation . On the right, we generate and from uniform and let and estimate . Following recent advances in , the proposed local estimator has a potential to be extended to, for example, Renyi entropy, but with a multiplicative bias as opposed to additive.
Discussion
The topic of estimation of an integral functional of an unknown density from i.i.d. samples is a classical one in statistics and we tie together a few pertinent topics from the literature in the context of the results of this manuscript.
Only the convergence analysis of the distances, and not the directions, is required for traditional -NN based estimators, such as the entropy estimator of . In the seminal paper, introduced resubstitution entropy estimators of the form with (as defined in (4)). This -NN estimator has a non-vanishing asymptotic bias, which was computed as with the digamma function and was suggested to be manually removed. For this was proved in the original paper of , which later was extended in to general . This mysterious bias term whose original proofs in provided little explanation for, can be alternatively proved with both rigor and intuition by making connections to uniform order statistics. For a special case of , with extra assumptions on the support being compact, such an elegant proof is provided in [2, Theorem 7.1] which explicitly applies the convergence of the nearest neighbor distance to uniform order statistics. Namely,
2 Convergence rate of the bias
Establishing the convergence rate of the KL estimator is a challenging problem, and is not quite resolved despite work over the past three decades. The convergence rate of the variance is established in under various assumptions. Establishing the convergence rate of the bias is more challenging. It has been first studied in , where root- consistency is shown in 1-dimension with bounded support and assuming is bounded below. is the first to prove a root mean squared error convergence rate of for general densities with unbounded support in 1-dimension and exponentially decaying tail, such as the Gaussian density. These assumptions are relaxed in , where zeroes and fat tails are allowed in . In general -dimensions, prove bounds on the convergence rate of the bias for finite , and for . Establishing the convergence rate for the bias of the proposed local estimator is an interesting open problem – it is interesting to see if the superior empirical performance of the local estimator is captured in the asymptotics of rate of convergence of the bias.
It is intuitive that kernel density estimators can capture the structure in the distribution if the distribution lies on a lower dimensional manifold. This is made precise in , which also shows improved convergence rates for distributions whose support is on low dimensional manifolds. However, the estimator in critically uses the geodesic distances between the sample points on the manifold. Given that the proposed estimators fit distributions locally, a concrete question of interest is whether such an improvement can be achieved without such an explicit knowledge of the geodesic distances, i.e., whether the local estimators automatically adapt to underlying lower dimensional structures.
3 Ensemble estimators
Recent works have proposed ensemble estimators, which use known estimators based on kernel density estimators and -NN methods and construct a new estimate by taking the weighted linear combination of those methods with varying bandwidth or , respectively. With a proper choice of the weights, which can be computed analytically by solving a simple linear program, a boosting of the convergence rate can be achieved. The key property that allows the design of such ensemble estimators is that the leading terms (in terms of the sample size ) of the bias have a multiplicative constant that only depends on the unknown distribution. An intuitive explanation for this phenomenon is provided in in the context of -NN methods; it is interesting to explore if such a phenomenon continues in the -LNN scenario studied in this paper. Such a study would potentially lead to ensemble-based estimators in the local setting and also naturally allow a careful understanding of the rate of convergence of the bias term.
Proofs
We first prove the derivation of the LLDE with degree in Equation (7). The gradient of the local likelihood evaluated at the maximizer is zero , which gives a computational tool for finding the maximizer:
where is the Gaussian kernel. Notice that the left-hand side of the equations are , and , respectively. The RHS can be written in closed forms as:
where assuming sufficiently small such that is positive definite. We want to derive from the equations. From (20) we get . Together with (21), we get . Hence, . Plug them in (19), we obtain the desired expression.
Analogously, for the derivation of the LLDE with degree in Equation (5), we get
This gives , and .
Proof of Lemma 3.1
Now consider the first term in (25). We consider two cases separately.
Case 2. If , let and . Note that
where the first inequality follows from the fact that . Since is continuously differentiable, by mean value theorem, there exists such that
By the assumption, there exists a ball such that and for all , so for sufficiently large such that , there exists some constant such that . Therefore, (28) is upper bounded by . Similarly, (28) is lower bounded by .
For simplicity, let . Then combining the two cases, the first term in (25) is bounded by:
Now consider the second term of (25). We will use Corollary 5.5.5 of to show that this term vanishes for and as grows.
Let be i.i.d. samples from unknown distribution with pdf . Let be the order statistics. Assume the density satisfies for and for , where and are constants. Then
where is a constant. are i.i.d standard exponential random variables.
where . Here we have:
If is twice continuously differentiable, we have:
where is the -sphere centered at with radius and is the spherical measure. By mean value theorem, there exists such that , where depends on . Therefore,
Since there exists a ball such that for all . Therefore, for sufficiently small such that , we have:
Therefore, by combing (30) and (37), we have:
Proof of Theorem 1
We first compute the asymptotic bias. We define new notations to represent the estimate as
Let . Since the terms are identically distributed, the expected value of converges to
Under this ansatz, perhaps surprisingly, we will show that the expectation inside converges to plus some bias that is independent of the underlying distribution. Precisely, for almost every and given ,
as where is a constant that only depends on and , defined in (44). This implies that
Together with (40), this finishes the proof of the desired claim.
We are now left to prove the convergence of (42). We first give a formal definition of the bias by replacing the sample defined quantities by a similar quantities defined from order-statistics, and use Lemma 3.1 to prove the convergence. Recall that our order-statistics is defined by two sequences of i.i.d. random variables: i.i.d. standard exponential random variables and i.i.d. random variables uniformly distributed over . We define
and we show that both terms converge to zero for any . Given that is continuous and bounded, this implies that
where the last inequality follows from Lemma 3.1. By the assumption that has open support and and is bounded almost everywhere, this convergence holds for almost every .
Assume as and , then
Combine (48) and (50) in (46), this implies the desired claim.
We next prove the upper bound on the variance, following the technique from [2, Section 7.3]. For the usage of Efron-Stein inequality, we need a second set of i.i.d. samples . For simplicity, denote be the kLNN estimate base on original sample and be the kLNN estimate based on . Then Efron-Stein theorem states that
Similarly, we can write for any . Therefore, the difference of and can be bounded by:
Take expectation over , we obtain:
where the last inequality comes from the assumption that . Combining with (51) and (54), we have
for . Given the CDF of , each term in (66) is upper bounded by:
Therefore, in order to establish an upper bound for (66), we need an upper bound for . Here we will consider two cases depending on . If , we just use the trivial upper bound . If , since , we have:
here we use the fact that so . Therefore, for . Combine the two cases and plug into (61), we obtain:
where is a constant only depend on . Therefore, we can see that
Proof of Theorem 2
The proposed estimator is a solution to a maximization problem . From we know that the maximizer is a fixed point of a series of non-linear equations of the form
Acknowledgement
This work is supported by NSF SaTC award CNS-1527754, NSF CISE award CCF-1553452, NSF CISE award CCF-1617745. We thank the anonymous reviewers for their constructive feedback.