Expand description
Junction-tree (clique-tree) exact inference for discrete pairwise/higher-order Markov Random Fields.
Implements the Lauritzen-Spiegelhalter / Hugin algorithm:
- Moralise the factor graph — connect every pair of variables that co-occur in the scope of some factor (this also marries co-parents).
- Triangulate the moral graph by eliminating variables in a heuristic order (min-fill, breaking ties by min-degree). The set of a variable together with its still-living neighbours at elimination time is a candidate clique.
- Collect the maximal cliques (drop any candidate that is a subset of another).
- Build a clique tree as a maximum-weight spanning tree over the cliques, where the weight of an edge between two cliques is the size of their separator (their shared variables). Maximising separator sizes guarantees the running-intersection property.
- Assign each input factor to a clique that contains its scope and multiply it into that clique’s potential.
- Calibrate with a Hugin-style two-pass schedule (collect to a root, then
distribute from the root) so that every clique holds the joint marginal over
its variables (up to a global scale equal to the partition function
Z).
All potentials are stored in the log domain (ln-potentials, row-major over
the clique’s joint configuration in increasing variable order) so that the
message passing never under/overflows. A configuration value of -inf
represents a zero-probability entry.
Structs§
- Clique
- A clique of the junction tree.
- Junction
Tree - A calibrated (or calibratable) junction tree for exact inference.
- Junction
Tree Config - Configuration for a junction tree: number of variables and their cardinalities.