词条 | Variational Bayesian methods |
释义 |
Variational Bayesian methods are a family of techniques for approximating intractable integrals arising in Bayesian inference and machine learning. They are typically used in complex statistical models consisting of observed variables (usually termed "data") as well as unknown parameters and latent variables, with various sorts of relationships among the three types of random variables, as might be described by a graphical model. As is typical in Bayesian inference, the parameters and latent variables are grouped together as "unobserved variables". Variational Bayesian methods are primarily used for two purposes:
In the former purpose (that of approximating a posterior probability), variational Bayes is an alternative to Monte Carlo sampling methods — particularly, Markov chain Monte Carlo methods such as Gibbs sampling — for taking a fully Bayesian approach to statistical inference over complex distributions that are difficult to directly evaluate or sample from. In particular, whereas Monte Carlo techniques provide a numerical approximation to the exact posterior using a set of samples, Variational Bayes provides a locally-optimal, exact analytical solution to an approximation of the posterior. Variational Bayes can be seen as an extension of the EM (expectation-maximization) algorithm from maximum a posteriori estimation (MAP estimation) of the single most probable value of each parameter to fully Bayesian estimation which computes (an approximation to) the entire posterior distribution of the parameters and latent variables. As in EM, it finds a set of optimal parameter values, and it has the same alternating structure as does EM, based on a set of interlocked (mutually dependent) equations that cannot be solved analytically. For many applications, variational Bayes produces solutions of comparable accuracy to Gibbs sampling at greater speed. However, deriving the set of equations used to iteratively update the parameters often requires a large amount of work compared with deriving the comparable Gibbs sampling equations. This is the case even for many models that are conceptually quite simple, as is demonstrated below in the case of a basic non-hierarchical model with only two parameters and no latent variables. Mathematical derivationIn variational inference, the posterior distribution over a set of unobserved variables given some data is approximated by a variational distribution, : The distribution is restricted to belong to a family of distributions of simpler form than , selected with the intention of making similar to the true posterior, . The lack of similarity is measured in terms of a dissimilarity function and hence inference is performed by selecting the distribution that minimizes . The most common type of variational Bayes uses the Kullback–Leibler divergence (KL-divergence) of P from Q as the choice of dissimilarity function. This choice makes this minimization tractable. The KL-divergence is defined as Note that Q and P are reversed from what one might expect. This use of reversed KL-divergence is conceptually similar to the expectation-maximization algorithm. (Using the KL-divergence in the other way produces the expectation propagation algorithm.) Variational techniques are typically used to form an approximation for: The marginalization over to calculate in the denominator is typically intractable. For example because the search space of is combinatorially large. Therefore, we seek an approximation, using . The KL-divergence can be written as or As the log evidence is fixed with respect to , maximizing the final term minimizes the KL divergence of from . By appropriate choice of , becomes tractable to compute and to maximize. Hence we have both an analytical approximation for the posterior , and a lower bound for the evidence (since the KL-divergence is always strictly non-negative). The lower bound is known as the (negative) variational free energy in analogy with thermodynamic free energy because it can also be expressed as a negative "energy" plus the entropy of . By generalized Pythagorean theorem of Bregman divergence, of which KL-divergence is a special case, it can be shown that [1][2]: where is a convex set and the equality holds if: In this case, the global minimizer with can be found as follows [1]: in which the normalizing constant is: The term is often called the evidence lower bound (ELBO) in practice, since [1], as shown above. By interchanging the roles of and we can iteratively compute the approximated and of the true model's marginals and respectively. Although this iterative scheme is guaranteed to converge monotonically [1], the converged is only a local minimizer of . If the constrained space is confined within independent space, i.e. the above iterative scheme will become the so-called mean field approximation as shown below. Mean field approximationThe variational distribution is usually assumed to factorize over some partition of the latent variables, i.e. for some partition of the latent variables into , It can be shown using the calculus of variations (hence the name "variational Bayes") that the "best" distribution for each of the factors (in terms of the distribution minimizing the KL divergence, as described above) can be expressed as: where is the expectation of the logarithm of the joint probability of the data and latent variables, taken over all variables not in the partition. In practice, we usually work in terms of logarithms, i.e.: The constant in the above expression is related to the normalizing constant (the denominator in the expression above for ) and is usually reinstated by inspection, as the rest of the expression can usually be recognized as being a known type of distribution (e.g. Gaussian, gamma, etc.). Using the properties of expectations, the expression can usually be simplified into a function of the fixed hyperparameters of the prior distributions over the latent variables and of expectations (and sometimes higher moments such as the variance) of latent variables not in the current partition (i.e. latent variables not included in ). This creates circular dependencies between the parameters of the distributions over variables in one partition and the expectations of variables in the other partitions. This naturally suggests an iterative algorithm, much like EM (the expectation-maximization algorithm), in which the expectations (and possibly higher moments) of the latent variables are initialized in some fashion (perhaps randomly), and then the parameters of each distribution are computed in turn using the current values of the expectations, after which the expectation of the newly computed distribution is set appropriately according to the computed parameters. An algorithm of this sort is guaranteed to converge.[3] In other words, for each of the partitions of variables, by simplifying the expression for the distribution over the partition's variables and examining the distribution's functional dependency on the variables in question, the family of the distribution can usually be determined (which in turn determines the value of the constant). The formula for the distribution's parameters will be expressed in terms of the prior distributions' hyperparameters (which are known constants), but also in terms of expectations of functions of variables in other partitions. Usually these expectations can be simplified into functions of expectations of the variables themselves (i.e. the means); sometimes expectations of squared variables (which can be related to the variance of the variables), or expectations of higher powers (i.e. higher moments) also appear. In most cases, the other variables' distributions will be from known families, and the formulas for the relevant expectations can be looked up. However, those formulas depend on those distributions' parameters, which depend in turn on the expectations about other variables. The result is that the formulas for the parameters of each variable's distributions can be expressed as a series of equations with mutual, nonlinear dependencies among the variables. Usually, it is not possible to solve this system of equations directly. However, as described above, the dependencies suggest a simple iterative algorithm, which in most cases is guaranteed to converge. An example will make this process clearer. A basic exampleConsider a simple non-hierarchical Bayesian model consisting of a set of i.i.d. observations from a Gaussian distribution, with unknown mean and variance.[4] In the following, we work through this model in great detail to illustrate the workings of the variational Bayes method. For mathematical convenience, in the following example we work in terms of the precision — i.e. the reciprocal of the variance (or in a multivariate Gaussian, the inverse of the covariance matrix) — rather than the variance itself. (From a theoretical standpoint, precision and variance are equivalent since there is a one-to-one correspondence between the two.) The mathematical modelWe place conjugate prior distributions on the unknown mean and variance, i.e. the mean also follows a Gaussian distribution while the precision follows a gamma distribution. In other words: We are given data points and our goal is to infer the posterior distribution of the parameters and The hyperparameters and are fixed, given values. They can be set to small positive numbers to give broad prior distributions indicating ignorance about the prior distributions of and . The joint probabilityThe joint probability of all variables can be rewritten as where the individual factors are where Factorized approximationAssume that , i.e. that the posterior distribution factorizes into independent factors for and . This type of assumption underlies the variational Bayesian method. The true posterior distribution does not in fact factor this way (in fact, in this simple case, it is known to be a Gaussian-gamma distribution), and hence the result we obtain will be an approximation. Derivation of q(μ)Then In the above derivation, , and refer to values that are constant with respect to . Note that the term is not a function of and will have the same value regardless of the value of . Hence in line 3 we can absorb it into the constant term at the end. We do the same thing in line 7. The last line is simply a quadratic polynomial in . Since this is the logarithm of , we can see that itself is a Gaussian distribution. With a certain amount of tedious math (expanding the squares inside of the braces, separating out and grouping the terms involving and and completing the square over ), we can derive the parameters of the Gaussian distribution: Note that all of the above steps can be shortened by using the formula for the sum of two quadratics. In other words: Derivation ofThe derivation of is similar to above, although we omit some of the details for the sake of brevity. Exponentiating both sides, we can see that is a gamma distribution. Specifically: Algorithm for computing the parametersLet us recap the conclusions from the previous sections: and In each case, the parameters for the distribution over one of the variables depend on expectations taken with respect to the other variable. We can expand the expectations, using the standard formulas for the expectations of moments of the Gaussian and gamma distributions: Applying these formulas to the above equations is trivial in most cases, but the equation for takes more work: We can then write the parameter equations as follows, without any expectations: Note that there are circular dependencies among the formulas for and . This naturally suggests an EM-like algorithm:
We then have values for the hyperparameters of the approximating distributions of the posterior parameters, which we can use to compute any properties we want of the posterior — e.g. its mean and variance, a 95% highest-density region (the smallest interval that includes 95% of the total probability), etc. It can be shown that this algorithm is guaranteed to converge to a local maximum. Note also that the posterior distributions have the same form as the corresponding prior distributions. We did not assume this; the only assumption we made was that the distributions factorize, and the form of the distributions followed naturally. It turns out (see below) that the fact that the posterior distributions have the same form as the prior distributions is not a coincidence, but a general result whenever the prior distributions are members of the exponential family, which is the case for most of the standard distributions. Further discussionStep-by-step recipeThe above example shows the method by which the variational-Bayesian approximation to a posterior probability density in a given Bayesian network is derived:
Most important pointsDue to all of the mathematical manipulations involved, it is easy to lose track of the big picture. The important things are:
Compared with expectation maximization (EM)Variational Bayes (VB) is often compared with expectation maximization (EM). The actual numerical procedure is quite similar, in that both are alternating iterative procedures that successively converge on optimum parameter values. The initial steps to derive the respective procedures are also vaguely similar, both starting out with formulas for probability densities and both involving significant amounts of mathematical manipulations. However, there are a number of differences. Most important is what is being computed.
A more complex example{{Dispute about|Equation correctness| date=April 2018}}Imagine a Bayesian Gaussian mixture model described as follows:[5] Note:
The interpretation of the above variables is as follows:
The joint probability of all variables can be rewritten as where the individual factors are where Assume that . Then where we have defined Exponentiating both sides of the formula for yields Requiring that this be normalized ends up requiring that the sum to 1 over all values of , yielding where In other words, is a product of single-observation multinomial distributions, and factors over each individual , which is distributed as a single-observation multinomial distribution with parameters for . Furthermore, we note that which is a standard result for categorical distributions. Now, considering the factor , note that it automatically factors into due to the structure of the graphical model defining our Gaussian mixture model, which is specified above. Then, Taking the exponential of both sides, we recognize as a Dirichlet distribution where where Finally Grouping and reading off terms involving and , the result is a Gaussian-Wishart distribution given by given the definitions Finally, notice that these functions require the values of , which make use of , which is defined in turn based on , , and . Now that we have determined the distributions over which these expectations are taken, we can derive formulas for them: These results lead to These can be converted from proportional to absolute values by normalizing over so that the corresponding values sum to 1. Note that:
This suggests an iterative procedure that alternates between two steps:
Note that these steps correspond closely with the standard EM algorithm to derive a maximum likelihood or maximum a posteriori (MAP) solution for the parameters of a Gaussian mixture model. The responsibilities in the E step correspond closely to the posterior probabilities of the latent variables given the data, i.e. ; the computation of the statistics , , and corresponds closely to the computation of corresponding "soft-count" statistics over the data; and the use of those statistics to compute new values of the parameters corresponds closely to the use of soft counts to compute new parameter values in normal EM over a Gaussian mixture model. Exponential-family distributionsNote that in the previous example, once the distribution over unobserved variables was assumed to factorize into distributions over the "parameters" and distributions over the "latent data", the derived "best" distribution for each variable was in the same family as the corresponding prior distribution over the variable. This is a general result that holds true for all prior distributions derived from the exponential family. See also
Notes1. ^1 2 3 {{cite arxiv|title=Copula Variational Bayes inference via information geometry|first1=Viet Hung|last1=Tran|year=2018|eprint=1803.10998|class=cs.IT}} 2. ^1 {{cite journal |last1=Adamčík |first1=Martin |title=The Information Geometry of Bregman Divergences and Some Applications in Multi-Expert Reasoning |journal=Entropy |date=2014 |volume=16 |issue=12 |page=6338–6381|bibcode=2014Entrp..16.6338A |doi=10.3390/e16126338 }} 3. ^{{cite book|title=Convex Optimization|first1=Stephen P.|last1=Boyd|first2=Lieven|last2=Vandenberghe|year=2004|publisher=Cambridge University Press|isbn=978-0-521-83378-3|url=http://www.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf|format=pdf|accessdate=October 15, 2011}} 4. ^Based on Chapter 10 of Pattern Recognition and Machine Learning by Christopher M. Bishop 5. ^Based on Chapter 10 of Pattern Recognition and Machine Learning by Christopher M. Bishop 6. ^ Sotirios P. Chatzis, “Infinite Markov-Switching Maximum Entropy Discrimination Machines,” Proc. 30th International Conference on Machine Learning (ICML). Journal of Machine Learning Research: Workshop and Conference Proceedings, vol. 28, no. 3, pp. 729-737, June 2013. References
| last1 = Bishop | first1 = Christopher M. | title = Pattern Recognition and Machine Learning | year = 2006 | publisher = Springer | ref = CITEREFBishop2006 | isbn = 978-0-387-31073-2 External links
1 : Bayesian statistics |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。