ArticleslgStudy

mathematics

Variational Bayesian methods

Variational Bayesian methods is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Variational Bayesian methods rather than just read about it. In short: 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 gr…

Variational Bayesian methods — main illustration
Variational Bayesian methods — illustration

Key takeaways

  • Variational Bayesian methods belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Variational Bayesian methods to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Variational Bayesian methods from memory before moving on to harder problems.

Reference excerpt

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 typical in Bayesian inference, the parameters and latent variables are grouped together as "unobserved variables". Variational Bayesian methods are primarily used for two purposes:

To provide an analytical approximation to the posterior probability of the unobserved variables, in order to do statistical inference over these variables. To derive a lower bound for the marginal likelihood (sometimes called the evidence) of the observed data (i.e. the marginal probability of the data given the model, with marginalization performed over unobserved variables). This is typically used for performing model selection, the general idea being that a higher marginal likelihood for a given model indicates a better fit of the data by that model and hence a greater probability that the model in question was the one that generated the data. (See also the Bayes factor article.) 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 evaluate directly or sample. 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 expectation–maximization (EM) algorithm from maximum likelihood (ML) or maximum a posteriori (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 update the parameters iteratively 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 derivation

Problem In variational inference, the posterior distribution over a set of unobserved variables Z = { Z 1 … Z n } {\displaystyle \mathbf {Z} =\{Z_{1}\dots Z_{n}\}} given some data X {\displaystyle \mathbf {X} } is approximated by a so-called variational distribution, Q ( Z ) : {\displaystyle Q(\mathbf {Z} ):}

P ( Z ∣ X ) ≈ Q ( Z ) . {\displaystyle P(\mathbf {Z} \mid \mathbf {X} )\approx Q(\mathbf {Z} ).}

The distribution Q ( Z ) {\displaystyle Q(\mathbf {Z} )} is restricted to belong to a family of distributions of simpler form than P ( Z ∣ X ) {\displaystyle P(\mathbf {Z} \mid \mathbf {X} )} (e.g. a family of Gaussian distributions), selected with the intention of making Q ( Z ) {\displaystyle Q(\mathbf {Z} )} similar to the true posterior, P ( Z ∣ X ) {\displaystyle P(\mathbf {Z} \mid \mathbf {X} )} . The similarity (or dissimilarity) is measured in terms of a dissimilarity function d ( Q ; P ) {\displaystyle d(Q;P)} and hence inference is performed by selecting the distribution Q ( Z ) {\displaystyle Q(\mathbf {Z} )} that minimizes d ( Q ; P ) {\displaystyle d(Q;P)} .

KL divergence The most common type of variational Bayes uses the Kullback–Leibler divergence (KL-divergence) of Q from P as the choice of dissimilarity function. This choice makes this minimization tractable. The KL-divergence is defined as

D K L ( Q ∥ P ) ≜ ∑ Z Q ( Z ) log ⁡ Q ( Z ) P ( Z ∣ X ) . {\displaystyle D_{\mathrm {KL} }(Q\parallel P)\triangleq \sum _{\mathbf {Z} }Q(\mathbf {Z} )\log {\frac {Q(\mathbf {Z} )}{P(\mathbf {Z} \mid \mathbf {X} )}}.}

… excerpt ends here. Continue reading the full article.

Illustrations

Variational Bayesian methods: Generalized Pythagorean theorem for Bregman divergence[2]
Generalized Pythagorean theorem for Bregman divergence[2]
Variational Bayesian methods: Pictorial illustration of coordinate ascent variational inference algorithm by the duality formula[4]
Pictorial illustration of coordinate ascent variational inference algorithm by the duality formula[4]
Variational Bayesian methods: Bayesian Gaussian mixture model using plate notation.  Smaller squares indicate fixed parameters; larger circles indicate random variables.  Filled-in shapes indicate known values.  The indication [K] means a vector of size K; [D,D] means a matrix of size D×D; K alone means a categorical variable with K outcomes.  The squiggly line coming from z ending in a crossbar indicates a switch — the value of this variable selects, for the other incoming variables, which value to use out of the size-K array of possible values.
Bayesian Gaussian mixture model using plate notation. Smaller squares indicate fixed parameters; larger circles indicate random variables. Filled-in shapes indicate known values. The indication [K] means a vector of size K; [D,D] means a matrix of size D×D; K alone means a categorical variable with K outcomes. The squiggly line coming from z ending in a crossbar indicates a switch — the value of this variable selects, for the other incoming variables, which value to use out of the size-K array of possible values.

Worked examples

Example 1 — a first encounter with Variational Bayesian methods

Start with the simplest possible case. Write down what Variational Bayesian methods claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Variational Bayesian methods before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Variational Bayesian methods ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Variational Bayesian methods

In research
Variational Bayesian methods appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Variational Bayesian methods in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Variational Bayesian methods is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bayesian statistics, so understanding it makes those chapters shorter.
In everyday life
Look for Variational Bayesian methods outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Variational Bayesian methods in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Variational Bayesian methods means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Variational Bayesian methods out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Variational Bayesian methods in simple terms?

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…

Why does Variational Bayesian methods matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Variational Bayesian methods?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Variational Bayesian methods.

Tags

  • Bayesian statistics

Keep exploring