- Introduced by
- Ghahramani & Jordan; Wainwright & Jordan (formal foundations)
- Year
- 1994–2008
- Type
- Approximate Bayesian inference
- Family
- Bayesian / computational
What does it do?
Variational inference with missing data is a scalable approximate Bayesian method that infers the distribution of missing values and latent variables within a single optimisation.
Instead of integrating exactly over the missing entries, it posits a tractable approximating distribution and fits it to the true posterior by maximising the evidence lower bound (ELBO). Model parameters enter the formulation given here as fixed quantities and are estimated in an outer loop. The method applies to large incomplete datasets where MCMC becomes slow, but its approximations typically underestimate posterior variances, so the results are best read as approximate summaries.
The intuition behind the method
When data have gaps, a Bayesian model treats the missing values as additional unknowns alongside the latent variables, so their joint posterior must be approximated. MCMC does this by sampling, which can be slow on large problems. Variational inference instead chooses a family of simpler distributions and picks the member closest to the true posterior in KL divergence, found by maximising the ELBO. In the scheme written here, one factor updates the distribution over missing values while another refines the distribution over latent variables. The two are cycled until the ELBO stops improving. Model parameters appear as fixed quantities in each ELBO and are estimated in an outer loop, as in variational EM. The imputed distributions for missing entries come out of the same optimisation rather than from a separate imputation stage.
History
Wainwright and Jordan (2008) give a general treatment of variational representations for exponential-family graphical models and describe variational methods as a complementary alternative to Markov chain Monte Carlo for approximate inference in large-scale models. Their framework shows how mean-field, expectation-propagation and related algorithms arise as exact or approximate forms of the same variational representations. Stochastic-gradient and black-box variants later extended these methods to large and non-conjugate models.
When to use it
Choose this approach when the dataset or model is too large for MCMC to be practical, when missingness can reasonably be assumed to be at random (MAR or MCAR), and when you want parameter inference and imputation from a single model. It fits latent-variable models such as mixture models, factor analysis and deep generative models applied to incomplete data. Avoid it when missingness plausibly depends on the unobserved values (MNAR) and the missingness process must be modelled explicitly, since the standard formulation does not include that. Also avoid it when accurate posterior variances are the main goal and the computational budget allows MCMC, because mean-field approximations tend to understate posterior variance.
Limitations and considerations
- The mean-field factorisation assumes missing values and latent variables are independent under q, which understates posterior correlations and variances.
- Coordinate-ascent and gradient-based updates converge to a local maximum of the ELBO, which need not be the best approximation available.
- The standard formulation assumes MAR; under MNAR the likelihood must be extended with an explicit model of the missingness mechanism.
- Because imputations are drawn from the approximate q, their spread can be narrower than what MCMC would give for the same model.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Scales to large datasets and high-dimensional latent-variable models where full MCMC integration over missing entries is slow.
- Infers model parameters and the distribution of missing values within one objective, so the imputations reflect the fitted model rather than a separate preprocessing step.
- The ELBO is a numeric objective that can be monitored across iterations to check whether optimisation has settled.
- Gradient-based implementations exist in probabilistic programming systems such as Pyro, NumPyro and Stan (mean-field ADVI), which can be used for non-conjugate models.
- Under MAR, missing entries are handled through the likelihood, without a separate ad hoc imputation step.
Applications
- Matrix factorisation and collaborative filtering with many missing ratings (recommender systems).
- Clinical and epidemiological studies with partially recorded covariates or outcomes.
- Latent factor models for incomplete genomic or neuroimaging data.
- Probabilistic PCA and variational autoencoders trained on data with missing features.
- Time-series imputation in sensor networks where observations are intermittently missing.
How it works
How it works
Specify a joint model over observed data, missing entries, and latent variables. Missing entries are treated as additional unknowns rather than dropped, so partially observed cases contribute through the observed part of the likelihood. Ignoring the missingness mechanism in this way is justified only when the data are missing at random (MAR) and the parameters of the data model and the missingness model are distinct, so that the likelihood factorises and the missingness model can be ignored. Whether data are MAR or MCAR cannot be verified from the observed data alone; it has to be justified from the substantive context of data collection.
Formula
p(x_{obs}, x_{mis}, z \mid \theta)The ELBO is a lower bound on the log marginal likelihood of the observed data. The identity log p(x_obs | theta) = L(q) + KL(q || p(x_mis, z | x_obs, theta)) holds exactly, so maximising the ELBO over q is equivalent to minimising the KL divergence between q and the true posterior over missing values and latent variables. The bound is tight when q equals that posterior. The ELBO bounds the observed-data log evidence only; it is not a predictive score for held-out observations.
Formula
\mathcal{L}(q) = \mathbb{E}_{q}[\log p(x_{obs}, x_{mis}, z \mid \theta)] - \mathbb{E}_{q}[\log q(x_{mis}, z)]The formula given uses a fully factorised (mean-field) form, in which q over missing values and q over latent variables are independent. Under this factorisation the ELBO separates into terms that can be optimised one factor at a time. Structured families that keep some dependence exist but are not the form written here, and the independence assumption is the source of the underestimated correlations discussed under limitations.
Formula
q(x_{mis}, z) = q_{mis}(x_{mis})\, q_z(z)Run coordinate-ascent variational inference (CAVI): update each factor in turn in closed form, holding the others fixed. For a mean-field factor q_j, the optimal update is proportional to exp(E_{-j}[log p(x_obs, x_mis, z | theta)]), where the expectation is taken over the other factors. Closed-form updates are available when the model is conjugate and in the exponential family. For example, categorical latent variables with Dirichlet priors give closed-form updates, whereas continuous models with non-conjugate priors generally do not. For non-conjugate models, stochastic gradient VI uses noisy estimates of the ELBO gradient, typically obtained by reparameterisation or black-box estimators. The specific update equations depend on the chosen model.
Track the ELBO after each sweep and stop when its increase between sweeps becomes small relative to a tolerance chosen by the user. Because the ELBO does not show the approximation error directly, also check posterior predictive fit on held-out observed entries and, where feasible, compare posterior moments against a short MCMC run on the same model.
Common pitfalls
- Using the method without asking whether missingness is plausibly MAR; under MNAR both the posterior and the imputed values can be biased.
- Reading the ELBO as the log-likelihood, or comparing ELBOs across models as if they were exact marginal likelihoods, while ignoring the KL gap to the true posterior.
- Choosing a mean-field family that rules out dependencies the data support, which leads to overconfident intervals for parameters and imputed values.
- Skipping posterior predictive checks on observed entries, which are the main check on whether the generative model fits the data.
Frequently asked questions
How does this differ from multiple imputation followed by analysis?
Multiple imputation (e.g., MICE) imputes missing values first, then analyses each completed dataset separately, combining results by Rubin's rules. Variational inference with missing data integrates imputation and inference into one joint optimisation, so parameter uncertainty and missing-value uncertainty propagate to each other simultaneously rather than in two separate stages.
Does variational inference assume a specific missingness mechanism?
Standard formulations assume missing at random (MAR): the probability of a value being missing depends only on observed quantities, not on the missing value itself. If data are missing not at random (MNAR), an explicit model of the missingness process must be included, which complicates the ELBO and requires additional assumptions.
Can I use this with neural network models like VAEs?
Yes. Variational autoencoders are a direct example: the encoder approximates the posterior over a latent code and the decoder reconstructs observations. Adapting them to missing data, for example by marginalising the decoder over missing entries during training, is an active area of research, and results depend on the chosen objective.
How do I know if the variational approximation is accurate enough?
Check that the ELBO converges, run posterior predictive checks on held-out observed entries and, where feasible, compare posterior moments against a short MCMC run on the same model. The gap between the ELBO and the log marginal likelihood is a KL divergence that cannot be computed without the true posterior, so a flat ELBO alone does not show that the approximation is good; the MCMC comparison is the more direct check.
What software supports this method?
Pyro and NumPyro (Python) support variational inference with automatic differentiation, including mean-field guides. Stan provides mean-field ADVI. For conjugate models, custom CAVI code is usually simple to write in Python or R.
Related methods
Sources
Ghahramani, Z. & Jordan, M. I. (1994). Supervised learning from incomplete data via an EM approach. In Cowan, J. D., Tesauro, G. & Alspector, J. (Eds.), Advances in Neural Information Processing Systems 6 (pp. 120–127). Morgan Kaufmann.
Open publication referenceWainwright, M. J. & Jordan, M. I. (2008). Graphical models, exponential families, and variational inference. Foundations and Trends in Machine Learning, 1(1–2), 1–305.
Open DOI reference