Urgent.News

What's breaking now, across thousands of outlets.

AI

Approximate Inference: Sampling the Posterior vs Optimizing an Approximation

In a simple probabilistic model, posterior inference sounds straightforward: observe some data, compute the posterior distribution over hidden variables, and use it to answer the question you care about. In complex models, that computation is often the hard part. The latent space may be high-dimensional, the posterior may have a complicated shape, and expectations under that posterior may be…

Approximate Inference aims to make posterior inference more tractable when the exact computation is difficult. There are two main approaches: MCMC and Variational Inference (VI).

MCMC constructs a Markov Chain that approaches the target posterior distribution. It starts from a complex posterior with high-dimensional latent variables and tries to sample from it using ergodic Markov Chains whose stationary distribution matches the posterior. The samples generated by the chain can then be used to estimate posterior quantities. The key idea is that MCMC does not require an exact closed-form expression for the posterior but focuses on approximating it through sampling.

In contrast, VI redefines the posterior-inference problem as an optimization problem. It approximates the complex posterior distribution with a simpler family of distributions, called the Variational Family Q. Each q(z) in Q is a candidate approximation to p(z|x). VI then selects the member of Q that is closest to the true posterior distribution by minimizing the Kullback-Leibler divergence between them.

This turns the inference problem into an optimization task, where the goal is to find the best approximation within the chosen family.

The core difference between MCMC and VI is that MCMC approaches the exact posterior through sampling, while VI approximates it with a tractable distribution found through optimization. Both methods aim to make posterior inference computationally manageable, but they do so in different ways. MCMC focuses on collecting samples, while VI focuses on optimizing the approximation. The choice between the two depends on the specific problem and the trade-offs between computational cost and accuracy.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

More from Thursday 10 September →