mbi.marginal_oracles.calculate_many_marginals

mbi.marginal_oracles.calculate_many_marginals(potentials: ~mbi.clique_vector.CliqueVector, marginal_queries: list[tuple[str, ...]], total: float = 1.0, belief_propagation_oracle: ~mbi.marginal_oracles.MarginalOracle = <PjitFunction of <function message_passing_stable>>, mesh: ~jax._src.mesh.Mesh | None = None) CliqueVector[source]

Calculates marginals for all the projections in the list using

Implements Algorithm from section 10.3 in Koller and Friedman. This method may be faster than calling variable_elimination many times. Note: this implementation is experimental, and further work may be needed to optimize it. Contributions are welcome.

Parameters:
  • potentials – Potentials of a graphical model.

  • marginal_queries – a list of cliques whose marginals are desired.

Returns:

A CliqueVector, where each defined over the list of input marginal_queries.