ReactiveMP.jl icon indicating copy to clipboard operation
ReactiveMP.jl copied to clipboard

What's the difference between `initmarginals` and `priors`?

Open wmkouw opened this issue 2 years ago • 2 comments

Some users have asked me what the difference between initmarginals and the prior distributions are, and whether they should be specified similarly.

  1. 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 model q (often called the variational model or recognition model) that approximates the original model p. We optimize q such that it matches the posterior p 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.

  2. The initial marginals do not need to be specified exactly like the priors.

wmkouw avatar May 20 '22 09:05 wmkouw

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?

bvdmitri avatar May 20 '22 10:05 bvdmitri

Ah, interesting. I suspect that this will work often as a default. But we should include a definition clarification in the documentation.

wmkouw avatar May 20 '22 10:05 wmkouw