ReactiveMP.jl
ReactiveMP.jl copied to clipboard
What's the difference between `initmarginals` and `priors`?
Some users have asked me what the difference between initmarginals
and the prior distributions are, and whether they should be specified similarly.
-
This is more of a theoretical question than a software issue, but I think it's good to archive it here. Priors are part of the model (i.e., need to be specified in @model) and will always have to be specified in a probabilistic model.
initmarginals
is a consequence of the inference technique variational Bayes (VB). In VB, we need to specify a second probabilistic modelq
(often called the variational model or recognition model) that approximates the original modelp
. We optimizeq
such that it matches the posteriorp
as well as possible. It is an iterative optimization procedure, meaning you have a starting point and iterate through update equations.initmarginals
defines the starting point. From a mathematical perspective, the initial marginals are only consequential if the objective function (i.e., free energy) is non-convex. From a software perspective, initializing the marginals can help ReactiveMP figure out which distributions to work with at which stage. -
The initial marginals do not need to be specified exactly like the priors.
We cannot get rid of the initmarginals
, but we can add an option to
inference(
...,
init_with_priors = true, # That option init messages/marginals with their corresponding priors (where possible)
)
What do you think Wouter?
Ah, interesting. I suspect that this will work often as a default. But we should include a definition clarification in the documentation.