mbi.marginal_oracles.message_passing_stable

mbi.marginal_oracles.message_passing_stable(potentials: CliqueVector, total: float = 1, mesh: Mesh | None = None, jtree: Graph | None = None) CliqueVector[source]

Compute marginals from (log-space) potentials using the message passing algorithm.

This implementation operates completely in logspace, until the last step where it exponentiates the log-beliefs to get marginals. It is very stable numerically, but in general could materialize factors defined over “super-cliques”, which are the nodes in the junction tree implied by the cliques in potentials. Thus, it may require more memory than “message_passing_fast” below.

Parameters:
  • potentials – The (log-space) potentials of a graphical model.

  • total – The normalization factor.

  • mesh – The mesh over which the computation should be sharded.

  • jtree – An optional junction tree that defines the message passing order.

Returns:

The marginals of the graphical model, defined over the same set of cliques as the input potentials. Each marginal is non-negative and sums to “total”.