Concentration of tempered posteriors and of their variational approximations
Pierre Alquier, James Ridgway
Introduction
In many applications of Bayesian statistics, the posterior is not tractable. Markov Chain Monte Carlo algorithms (MCMC) were developed to allow the statistician to sample from the posterior distribution even in situations where a closed-form expression is not available. MCMC methods were successfully used in many applications, and are still one of the most valuable tools in the statistician’s toolbox. However, many modern applications of statistics and machine learning involve such massive datasets that sampling schemes such as MCMC have become impractical. In order to allow the use of Bayesian approaches with these datasets, it is actually much faster to compute variational approximations of the posterior by using optimization algorithms. Variational Bayes (VB) has indeed become a corner stone algorithm for fast Bayesian inference.
VB has been applied to many challenging problems: matrix completion for collaborative filtering , NLP on massive datasets , video processing , classification with Gaussian processes , among others. Chapter 10 in is a good introduction to VB and provides an exhaustive survey.
Despite its practical success very little attention has been put towards theoretical guaranties for VB. Asymptotic results in exponential models were provided in . More recently, proposed a very nice asymptotic study of approximations in parametric models. The main problem with these results is that by nature they cannot be applied to high-dimensional or nonparametric models, or to model selection. In the machine learning community, also studied VB approximations. In a distribution-free setting, there is actually no likelihood, but a pseudo-likelihood can be defined through a suitable loss function and thus it is possible to define a pseudo-posterior. Thanks to PAC-Bayesian inequalities from , derived rates of convergence for VB approximation of this pseudo-posterior. However, the tools used in are valid for bounded loss functions, so there is no direct way to adapt this method to study VB approximations when the log-likelihood is unbounded.
In this paper, we propose a general way to derive concentration rates for approximations of fractional posteriors. Concentration rates are the most natural way to assess “frequentist guarantees for Bayesian estimators”: the objective is to prove that the posterior is asymptotically highly concentrated around the true value of the parameter. This approach is now very well understood, we refer the reader to the milestone paper , an account of recent advances can be found in in . Recently, studied the situation where the likelihood is replaced by for , leading to what is usually called a fractional or tempered posterior. They proved that concentration of the fractional posterior requires actually fewer hypothesis than concentration of the (true) posterior. Extending the technique of , we analyze the concentration of VB approximations of (fractional) posteriors. Especially, we derive a condition for the VB approximation to concentrate at the same rate as the fractional posterior.
2 Definitions and notations
Let . Let and be two probability measures. Let be any measure such that and , for example . The -Rényi divergence and the Kullback-Leibler (KL) divergence between two probability distributions and are respectively defined by
We remind the reader of a few properties proven in . First, it is obvious that does actually not depend on the choice of the reference measure . This is sometimes made explicit by the (informal) statement . The measures and are mutually singular if and only if .
We have which gives ground to the notation . For , , being the total variation distance – for this is Pinsker’s inequality. The map is nondecreasing. Also, the authors of note that the -Rényi divergences are all equivalent for , through the formula for . Additivity holds: , thus ; the squared Hellinger distance.
The fractional posterior, that will be our ideal estimator, is given by
Let ,
In Sections 3, 4 and 5 we apply our general results in various settings. In Section 3 we study the parametric family of Gaussian approximations
Main results
For any , for any ,
It is tempting to minimize the right-hand side (r.h.s) of the inequality in order to ensure a good estimation. The minimizer of the r.h.s can actually be explicitly given. In order to do this, let us recall Donsker and Varadhan’s variational inequality (Lemma 1.1.3 in ).
Using Lemma 2.2 with and the definition of we obtain
so the minimizer of the r.h.s of Theorem 2.1 is actually .
Theorem 2.1 can be used to study other approximations of the posterior. For example, as suggested by one of the Referees, we can use it to study distributions centered around the maximum a posteriori (MAP) or the maximum likelihood estimate (MLE). For example, Laplace approximations are Gaussian distributions centered at the MLE. However, there are models where the MLE and the MAP are not defined, while the posterior and some variational approximations are consistent. Such an example is provided in the Supplementary Material.
2 Concentration of VB approximations
We specialize the above results to the variational approximation. Elementary calculations show that
As a consequence, we obtain the following corollary of Theorem 2.1.
For any and , with probability at least ,
Fix . Assume that a sequence is such that there is a distribution such that
Then, for any , for any ,
This theorem is a consequence of Corollary 2.3, its proof is provided in Section 7. Let us now discuss the main consequences of this theorem.
Note that the assumption involving a distribution is not standard. This requires some explanations. Consider first the case . Define , for , as
Then the choice , i.e. restricted to , ensures immediately (2.1), and (2.2) can be rewritten
This assumption is standard to study concentration of the posterior, see Theorem 2.1 page 503 in or Subsection 3.2 in . Our message is that in the studies of concentration of the posterior, the choice was hidden. Other choices might lead to easier calculations in some situations. More importantly, in the relevant case , in general. Thus is no longer sufficient, and (2.1) and (2.2) are natural extensions of this assumption to study VB. They provide an explicit condition on the family in order to ensure concentration of the approximation.
Choosing and we obtain a more readable concentration result. It shows that, as soon as , the sequence gives a concentration rate for VB.
Under the same assumptions as in Theorem 2.4,
As a special case, when , the theorem leads to a concentration result in terms of the more classical Hellinger distance
Also, with a general , from the properties recalled in Remark 1.1, we have, for ,
3 A simpler result in expectation
It is possible to simplify the assumptions at the price of stating a result in expectation instead of concentration.
Fix . Then
Assume that is such that there is distribution such that
4 Extension of the result in expectation to the misspecified case
In this section we do not assume any longer that the true distribution is in . In order not to change all the notations we define an extended parameter set where and define as the true distribution. Theorem 2.6 can be applied to this setting, and we obtain:
Now, rewriting, for ,
Assume that, for , there is and with
In the well-specified case, and we recover Theorem 2.6. Otherwise, this result takes the form of an oracle inequality. It is not a sharp oracle inequality as that the risk measure used in the l.h.s and the r.h.s are not the same, but remains informative when is small. For example, in Section 5 below, we provide a nonparametric example where and Theorem 2.7 leads to the minimax rate of convergence.
Gaussian variational Bayes
thus the algorithm will consist in projecting onto the set of Gaussian distributions. Depending on the hypotheses made on the covariance matrix we can build different approximations. For instance define:
We have by definition .
The remarkable fact of Gaussian VB is that it allows to recast integration as a finite dimension optimization problem. The choice of a specific Gaussian is a trade off between accuracy and computational complexity. We will show in the following that, under some assumption on the likelihood, the integrated -Rényi divergence is convergent for most of the approximations.
To simplify the exposition of the results we will restrict our study to the case of Gaussian priors: . One can readily see that in Theorem 2.4 the prior appears only in the condition , many other distribution could be used, providing different rates.
In the rest of the section we assume that the density is log Lipschitz.
There is a measurable real function such that
An example is logistic regression, see Subsection 3.2 below.
Let the approximation family be with as defined above and that the model satisfies Assumption 3.1. We put
Then for any , for any
In many cases the model is not conjugate, i.e. the VB objective does not have a closed-form solution. We can however use a full Gaussian approximation and a stochastic gradient descent on the objective function defined by the KL divergence. This approach has been studied in .
We may write our variational bound as the following minimisation problem
In the authors suggest using a parametrization of the problem where we replace the optimization over by a minimization over the matrix where . To simplify the notations in this section define
to be the objective of the minimization problem (3.1), where and
In order to be able to state non-asymptotic results on the stochastic gradient algorithms, we restrict the parameter space to an Euclidean ball, that is (3.1) is transformed into
The objective can now be replaced by a Monte Carlo estimate and we can use stochastic gradient descent as described in Algorithm 1.
Assume that , as defined in (3.2), is convex in its first component and that it has -Lipschitz gradients.
On most examples the gradient is a sum of at least components. If each term is Lipschitz with constant , an estimate of the constant will be . The additional term of the bound is therefore of the order , hence a good choice is to mitigate the impact of the numerical approximation on the rate.
2 Example: logistic regression
We consider the case of a binary regression model. Although estimation of parameters is relatively simple for small datasets , it remains challenging when the size of the dictionary is large. Furthermore usual deterministic methods do not come with theoretical guarantees as would a gradient descent algorithm for maximum likelihood. Note that the logistic regression is not conjugate in the sense that we cannot find an iterative scheme based on a mean field approximation, as will be done for the matrix completion example in Section 4.
We will prove results in the case of random design where we suppose that the distribution of does not depend on the parameter.
then for any , for any
Note that the only assumption on the distribution of is that . Still, it is interesting to compute and on some examples. For example, when is uniform on the unit sphere, and . When then and . In both cases, the terms in and do not deterioriate the parametric rate of convergence . Furthermore the Lipschitz constant can be bounded explicitly under additional assumptions on the design matrix (e.g. bounded singular value) and leads to . Hence taking one would get a bound in . We can take of the order in order not to deteriorate the rate.
Application to matrix completion
where the are i.i.d . For the sake of simplicity we will assume that the are i.i.d , and that is known, so we only have to estimate . Note that for , , see (10) page 3800 in . Thus, for ,
which depends only on , and the matrices and so we will use the notation . In the case ,
where denotes the Frobenius norm. In the noiseless case , proved that it is possible to recover exactly under the assumption that its rank is small enough. Various extensions to noisy settings, approximately low-rank matrices, or other loss functions can be found in . The main message of these papers is that the minimax rate of convergence is , possibly up to log terms. Bayesian estimators were proposed in using factorized Gaussian priors. Convergence of the posterior mean was proven in for a bounded prior, excluding the Gaussian prior used in practice. Similarly, proves concentration of a truncated version of the posterior. For very large datasets the MCMC algorithm proposed in is too slow, a VB approximation was proposed in with very good results on the Netflix dataset. This approximation was re-used and extended by many authors including . But the consistency of the Bayesian estimator with Gaussian priors and of its variational approximations are opened questions.
First, we will recall the Gaussian prior and the VB approximation . We will then prove the concentration of the VB approximation, and as a consequence the concentration of the tempered posterior.
2 Definition of the prior and of the VB approximation
Fix . The main idea of factorized priors is that, when then we have
for some matrices of dimension and of dimension . Thus, we can define a prior on by specifying priors on and . A usual choice is that the entries and are independent and finally is inverse gamma, that is . These choices ensure conjugacy: put , it is then possible to compute the conditional posteriors of , of and . This allows to use the Gibbs sampler . For large datasets, proposed mean-field VB with given by
The minimization of the VB program is shown in many cited papers, see and all the references therein. Shortly: is , is and is for some matrix whose rows are denoted by , some matrix whose rows are denoted by and some vector . The parameters are updated iteratively through the formulae
(where denotes the -th entry of the matrix and denotes the -th entry of the matrix ).
3 Concentration of the posteriors
Fix as any constant. There is a small enough such that
where the constant . In particular, the result holds for the choice .
In practice, it is important that is small to ensure a good approximation of low-rank matrices . We don’t claim that is the optimal value, recommends cross-validation to tune .
Note as a special case that when for then we have exactly
This result is the first consistency result for the VB approximation with Gaussian priors, that is used in practice. Still, it is stated for a “weak” distance criterion . Under additional assumptions, it is actually possible to relate this criterion to the standard Frobenius norm. Assume that there is a known such that . This assumption is satisfied in many applications like collaborative filtering: in the Netflix data the entries are between and . Then it is natural to project any estimator to the set of matrices with bounded entries. Precisely, define for any the matrix its -th entry: . A simple study of , detailed in the proofs section, leads to the following result.
Under the assumptions of Theorem 4.1, and when in addition , then
Note that once the Gaussian approximation of the posterior is known, it is easy to sample from it and to clip the samples to approximate the posterior mean of . So under the boundedness assumption we have a bound based on the Frobenius norm for an effective procedure based on VB. It is known that for the squared Frobenius norm, the rate is minimax optimal – maybe up to log terms .
Still assuming that for it is also possible to state a proper concentration result as an application of Corollary 2.5. We omit the proof as it is exactly similar to the one of Theorem 4.1.
Assume for and take as in Theorem 4.1. Then
where for some explicit constant ,
Nonparametric regression estimation
In this section, we provide a nonparametric example. Thus, the parameter will actually be a function . We assume that are i.i.d from a distribution , and the model is given by: and
where . We will provide a prior and a mean-field approximation of the posterior. We will show that we estimate the functions belonging to a Sobolev ellipsoid at the minimax rate of convergence, up to terms (the definitions of the ellipsoids will be reminded below). The reader might think that this example is not the most striking application of VB. On the other hand, it is an illustration of the generality of our method. We will estimate using projections on the Fourier basis and the choice of the number of coefficients will be done by model selection. It appears that in this case, model selection can be seen as a variational approximation where the constraint on the posterior is to give all its mass to only one model. This leads to adaptation of the estimator, in the sense that it is not required to know nor to compute the estimator.
First, we recall the definition of the trigonometric basis :
We now define a prior distribution by describing how to draw from : we first draw from a geometric distribution, . We then draw i.i.d from a distribution. We finally put
Note that when and all the ’s are non-zero, such a function is never “produced” by the prior. Still, we will see that the prior gives enough mass to functions in the neighborhood of , ensuring consistency.
2 Construction of the variational approximation
Note that the support of has dimension , but the support of is infinite-dimensional. Thus, we can expect the support of the tempered posterior to be also infinite-dimensional, and to be intractable. We define a variational approximation that will fix these problems.
First, for define as the set of probability measures where on functions such that under , the ’s are independent and . We put . Note that the choice of a constant variance was motivated by the fact that the estimator of studied for example in , , satisfies . Then
(that is, the approximated posterior mean is simply a ridge regression estimator).
3 Nonparametric rates of convergence
We remind the definition of the Sobolev ellipsoid given (see e.g. Chapter 1 in ) for and :
Fix . Assume that there is an and a such that . Then
The proof is in Section 7. Note that on the contrary to previous sections, we only provide an asymptotic statement here. However, from the proof of Theorem 5.1, it is clear that it is possible to provide a non-asymptotic statement as well (with cumbersome constants).
Here again, note that the distance criterion used in the left-hand side is not standard. We actually have:
However, when , is bounded by a constant that depends on and . If we moreover assume that is bounded by a known constant , we can as in Section 4 define a clip operator: and obtain:
The rate is known to be minimax optimal on for the squared -norm . The additional term is sometimes referred to as “the price to pay for adaptation”. In the case of the -norm this is misleading as it is actually possible to build an adaptive estimator that reaches the minimax rate without the additional , but up to our knowledge this is not possible with a fully Bayesian estimator.
Conclusion
Based on PAC-Bayesian inequalities, we introduced a generic method to study the concentration of variational Bayesian approximations. This is a very general approach that can be applied to many models. We studied applications to logistic regression, matrix completion and density estimation. Still, some questions remain open. From a theoretical perspective, the oracle inequality in Theorem 2.7 compares a Rényi divergence to a Kullback-Leibler divergence. It would be very interesting to obtain a result with the Kullback divergence in the left-hand side. This is probably more difficult, if possible at all. We believe that tools from could be of some help, but some work is needed to make explicit the assumptions of this paper in our context.
Also, since the first version of this work was submitted, extensions were proven by other authors: extended our results to models with hidden variables, such as mixture models, and proved results in the case and study many nonparametric examples. Note that while remains the most popular choice in practice, these results require much stronger assumptions and cannot in general be extended to the misspecified case .
An important open issue is the choice of the parameter . It is clear that our results are not helpful to solve this issue. Some previous work proposes to use cross-validation , but this is computationaly expensive. Moreover, no theoretical guarantees are known in this case. In the misspecified case, proposed an online adaptive tuning of this parameter. However, it is not clear if this method could work in our context. This should be the object of a future work.
Finally, it would be nice to get rid of the extra log in the rates. Catoni’s localization technique is a nice tool to remove extra log factors in PAC-Bayesian bounds, but its adaptation to our setting is not direct. It could be the object of future works.
Acknowledgements
We would like to thank Badr-Eddine Chérief-Abdellatif, as well as the Associate Editor and the anonymous Referees, for their helpful comments and suggestions on the paper.
Proofs
We adapt the proof given in . Fix , and . It’s immediate to check that
The key argument here, introduced by , is to use Lemma 2.2. Note that almost surely with respect to the sample, we know that
Multiply both sides by to get
2 Proof of Theorem 2.4
Now apply take the union bound of this inequality and of the inequality in Corollary 2.3. We obtain, for any , for any , with probability at least ,
where in the last step we use the assumptions on .
3 Proof of Theorem 2.6
The beginning is as for Theorem 2.1. Fix , then
This is where things change: we now use Jensen’s inequality to obtain
4 Proof of Theorem 3.1
We start by defining a sequence indexed by a positive scalar to be later defined. As before by proving the result on the smallest family of distribution, it will remain true on larger ones using the fact that . Under Assumption 3.1 we can check the hypotheses on the KL between the likelihood terms as required in Theorem 2.4. We have
When integrating with respect to we have
To apply Theorem 2.4 it remains to compute the KL between the approximation of the pseudo-posterior and the prior,
To obtain an estimate of the rate of Theorem 2.4 we put together those bounds. Choosing we can apply it with
5 Proof of Theorem 3.2
Following the rest of the proof of 2.6 we get
To bound the first term of the right hand-side we use Assumption 3.1 and the proof of Theorem 3.1. In particular notice that , we get straight away
We now study the term inside the brackets on the right hand-side.
Divide by , take expectation with respect to
Notice that belongs to the -algebra generated by . By a multiple use of the tower property we get,
Putting everything together concludes the proof.
6 Proof of Corollary 3.3
Direct calculation shows that the log-likelihood is -Lipschitz hence satisfying Assumption 3.1. We conclude using Theorem 3.1 and the assumption on the design matrix.
7 Proof of Corollary 3.4
Start by noticing that we can take as
where the likelihood part is convex with Lipschitz gradient as a composition of a convex and gradient Lipschitz function with a affine map. The Lipschitz constant for this term is bounded by . The KL part can be written as which is convex for positive semi-definite . We need to check that the gradients of the objectives are also Lipschitz, the only problematic term is . Denote the eigen values of
To apply Theorem 3.2 we also need to check that the new constraint contains the Gaussian distribution used in the proof. This is the case as long as .
The supplementary material contains the toy example mentioned in Remark 2.1 above.
The remaining proofs, that is, the proofs of Theorems 4.1 and 5.1 and of Corollary 4.2, are also provided in the supplementary material.
References
Supplementary material
In this subsection, we provide the toy example announced in the paper, where the MLE (and thus the MAP) are not defined. Then, we show that there is a variational approximation that leads to a consistent estimator. This also implies that the tempered posterior is also consistent in this case.
The prior is given by: and (uniform distribution).
8.2 Non-existence of the MLE
It is easy to check that when are i.i.d from then the likelihood function
Thus, the MLE is not defined. For the same reason, the MAP does not exist either.
8.3 A variational approximation family
Note that the family is inspired by Catoni’s point of view to use a “perturbed MLE” in PAC-Bayesian bounds. An application of Theorem 2.6 leads to the following result.
As a corollary, we also have that the tempered posterior satisfies the same inequality.
8.4 Proof of Proposition 7.1
Assume that and for some . Then:
This implies that for any ,
The value gives, using to simplify things,
9 Proof of Theorem 4.1
Fix , and any pair and define for that will be chosen later,
Note that it can be factorized so it belongs to the family .
We adapt the calculations from but simplify a lot. First, note that
and that for any in the support of we have
with the choice which satisfies . Then, we derive
for any event . We actually take and is to be chosen later. Then note that
with which satisfies . Then, for ,
where we replaced and by their respective value. In order to keep the expressions as simple as possible we can use and to get
We are now in position to apply Theorem 2.6. Then
10 Proof of Corollary 4.2
We start from (4.1). Under the boundedness assumption on it is obvious that , , so
Fix and for short, put . We have:
By assumption, . Straightforward derivations show that for any we have
Pluging this into (7.4) gives the result claimed.
11 Proof of Theorem 5.1
Let denote the coefficients of : . Theorem 2.6 gives:
The choice gives:
From Chapter 1 in we know that implies for some . Moreover, . So finally:
The choice leads to the result.