Analytic sine VI and MF-VI examples#

Variational inference (VI) approximates a posterior distribution by optimizing a Gaussian approximation. Multifidelity VI (MF-VI) uses additional inexpensive surrogate evaluations to reduce estimator cost.

These examples infer seven coefficients in a one-dimensional sine-series problem with a known Gaussian posterior, allowing the numerical results to be compared with the exact solution.

Diagonal Gaussian posterior#

Equispaced observations produce a nearly diagonal posterior. This example compares mean-field VI and MF-VI with the exact posterior.

Run python examples/vi_mf_vi_demo/diagonal_example.py.

KL convergence for diagonal VI and MF-VI

Convergence toward the exact posterior.#

Diagonal VI and MF-VI posterior marginals

Exact and approximate posterior marginals.#

Correlated Gaussian posterior#

Non-equispaced observations induce posterior correlations. This example compares full-covariance and mean-field VI/MF-VI, highlighting the approximation error caused by a diagonal covariance restriction.

Run python examples/vi_mf_vi_demo/full_covariance_example.py.

KL convergence for correlated VI and MF-VI

Full-covariance VI and MF-VI convergence.#

Posterior correlation matrices for exact and approximate distributions

Comparison of posterior correlation structure.#

Source and further details#

To regenerate the figures, run python examples/vi_mf_vi_demo/generate_docs_media.py.