R · Open source
variational-inference
Coordinate-Ascent Variational Inference From First Principles
A concise R implementation and mathematical walkthrough of mean-field variational inference for a conjugate normal model.
Overview
This project works through coordinate-ascent variational inference for a univariate normal model with unknown mean and variance. The R code keeps each parameter update visible and records the evidence lower bound at every iteration.
A written derivation accompanies the implementation, so the equations can be matched directly to the update steps in the code.
Technical highlights
- Mean-field Normal and Inverse-Gamma approximation
- Closed-form coordinate updates
- ELBO convergence tracking
- Posterior-density visualization
Topics
Variational BayesApproximate inferenceBayesian statisticsELBO optimizationR