Variable Elimination for Exact Inference
An algorithm for computing exact probabilities in a graphical model by summing out one variable at a time in a smart order, instead of ever building the full joint table over every variable at once.
Prerequisites: Probabilistic Graphical Models, Bayesian Networks and Joint Factorization
Given a graphical model over many variables, the naive way to compute a marginal probability, say, "what's the probability the market regime is 'crisis' given three observed signals?", is to build the full joint distribution over every variable and sum out the ones you don't care about. That table grows exponentially with the number of variables, making it hopeless beyond a handful. Variable elimination avoids ever building it: because the joint distribution already factors into small local functions (one per clique in the graph), you can sum out one unwanted variable at a time, multiplying together only the factors that mention it, producing a smaller intermediate factor, and repeating until only the variables you want remain.
The trick that makes this efficient is elimination order: summing out variables in a good order keeps the intermediate factors small, while a bad order can make them balloon back toward the full joint table. Choosing a near-optimal order is itself a hard combinatorial problem in general, but for chain- or tree-structured graphs (like hidden Markov models) there's a natural order, eliminate from the ends inward, that keeps every intermediate factor small automatically.
For a three-variable chain , eliminating first only requires multiplying the two factors mentioning and summing over 's values, leaving a small factor over alone, never touching until the next step, and never forming the full table.
Variable elimination computes exact marginal probabilities by exploiting the graphical model's factorization, summing out unwanted variables one at a time rather than building the exponentially large full joint table, its efficiency depends entirely on choosing an elimination order that keeps intermediate factors small.
Discussion
💡 Discussion rules
- Ask and answer about this concept. Off-topic gets removed.
- No homework dumps. Show what you tried first.
- Corrections are welcome. Cite a source when you claim an error.
Loading discussion…
Related concepts
Further reading
- Koller and Friedman, Probabilistic Graphical Models, ch. 9