The junction tree algorithm (also known as the clique tree algorithm) is a method for exact probabilistic inference in graphical models, such as Bayesian networks and Markov random fields. It computes marginal probabilities — and probabilities conditional on observed evidence — by transforming the model's graph into a tree-structured data structure called a junction tree, and then performing message passing (a form of belief propagation) on that tree.
Purpose
Exact computation of marginal distributions in a general probabilistic graphical model is computationally infeasible for large networks if performed naively, because it involves summing over an exponential number of states. The junction tree algorithm exploits the conditional independence structure of the graph to arrange the computation efficiently. It generalizes variable elimination: instead of re-running the elimination for each new query, the model is compiled once into a junction tree that supports the simultaneous computation of a large class of queries, such as the marginal distribution for every clique of variables.
Construction
Given a probabilistic graphical model, a junction tree is typically obtained through the following steps:
- Moralization. If the model is a directed acyclic graph (a Bayesian network), it is converted to an undirected graph: each pair of parents sharing a common child is connected ("married"), and the directions of the arcs are dropped. This is necessary because directed and undirected graphs encode different independence assumptions.
- Evidence insertion. Observed variables are clamped to their observed values (this step concerns the calculation of conditional probabilities).
- Triangulation. Edges are added so that the graph becomes chordal (triangulated): every cycle of length four or more acquires a chord. A standard theorem states that an undirected graph is triangulated if and only if its clique graph admits a junction tree, which is equivalent to the existence of an elimination ordering that introduces no fill-in edges.
- Junction tree formation. The maximal cliques of the triangulated graph become the nodes ("clusters") of the tree. A tree over these cliques is a junction tree if it satisfies the running intersection property: whenever a variable belongs to two cliques, it belongs to every clique on the path between them. Such a tree can be found, for example, by extracting a maximum-weight spanning tree of the clique graph, with edges weighted by the size of the intersection of the adjacent cliques (a task that can be performed with a modification of Kruskal's algorithm).
- Initialization. Each clique is assigned a non-negative potential (and each separator — the intersection between adjacent cliques — a potential, typically initialized to 1). For a Bayesian network, the potentials are chosen so that their normalized product reproduces the original joint distribution, with each conditional probability factor assigned to a clique containing the relevant variables.
Message passing
After initialization, messages — marginalized and rescaled versions of clique potentials — are exchanged between adjacent cliques. A common scheme proceeds in two phases: a collection phase, in which messages propagate from the leaves of the tree toward a chosen root, followed by a distribution phase, in which messages propagate from the root back to the leaves. When both phases are complete, all clique and separator potentials are mutually consistent, and each clique potential equals the marginal distribution over the variables of that clique. Evidence can then be introduced by modifying potentials with indicator functions and re-propagating, after which the potentials represent the posterior distributions given the evidence. The junction tree property guarantees that this local propagation yields globally consistent results.
Variants
Two widely used message-passing architectures on the junction tree are:
- Shafer–Shenoy algorithm. Messages are computed recursively from products of the neighboring cliques' potentials; separator potentials are not stored. It corresponds to the sum-product algorithm applied to the junction tree.
- Hugin algorithm. Separator potentials are cached and updated, so that messages need not be repeatedly recomputed. It is described in course material as a time-efficient variant of the Shafer–Shenoy scheme. Hugin is also the name of a Bayesian-network software system that implements this machinery.
Complexity
The time and space requirements are dominated by the size of the largest cluster in the junction tree, which corresponds to the treewidth of the original graph. For discrete (tabular) potentials, the complexity is exponential in this width; for Gaussian models, it is cubic in the width. The number of cliques in a junction tree is linear in the number of variables, so the total number of messages is also linear. Finding a triangulation — equivalently, an elimination ordering — that minimizes the clique sizes is an NP-hard problem, so heuristic orderings are used in practice.
History
The local-computation approach originates in the study of expert systems, principally the 1988 paper by Steffen L. Lauritzen and David J. Spiegelhalter, "Local computations with probabilities on graphical structures and their application to expert systems" (Journal of the Royal Statistical Society, Series B), which also introduced the widely used "Chest Clinic" diagnostic example. Related early work includes Judea Pearl's Probabilistic Reasoning in Intelligent Systems (1988), and the framework was consolidated in the textbook Probabilistic Networks and Expert Systems by Cowell, Dawid, Lauritzen and Spiegelhalter (1999).
Notes on terminology
In the literature, the terms "junction tree" and "clique tree" are often used interchangeably, although some authors reserve "junction tree" for trees of cliques satisfying the running intersection property, and use "clique tree" for the more general object. When message passing is attempted on cyclic structures rather than a proper tree, convergence is not guaranteed; this approximate variant is known as loopy belief propagation.
References
- Lauritzen, S. L., & Spiegelhalter, D. J. (1988). "Local computations with probabilities on graphical structures and their application to expert systems." Journal of the Royal Statistical Society, Series B, 50(2), 157–194.
- Cowell, R. G., Dawid, A. P., Lauritzen, S. L., & Spiegelhalter, D. J. (1999). Probabilistic Networks and Expert Systems. Springer.
- Pearl, J. (1988). Probabilistic Reasoning in Intelligent Systems. Morgan Kaufmann.
- Koller, D., & Friedman, N. (2009). Probabilistic Graphical Models: Principles and Techniques. MIT Press.
- Huang, C., & Darwiche, A. (1996). "Inference in Belief Networks: A procedural guide." International Journal of Approximate Reasoning, 15(3), 225–263.
- Evans, R., Graphical Models, Chapter 7: "Junction Trees and Message Passing" (University of Oxford lecture notes).
- Paskin, M., "The Junction Tree Algorithms" (Stanford University course notes).
- Murphy, K., "The junction tree algorithm" (University of British Columbia notes).
- "Junction tree algorithm," Wikipedia.