The Redundancy Problem in Enumeration
Example Query:
Compute P(B | A) in a simple network: A → B → C → D
P(B | A) = α · P(B, A)
where α is the normalization constant
Enumeration Approach (Wasteful!)
Enumerate over all hidden variables (C and D):
P(B,A) = P(A,B,C=T,D=T) +
P(A,B,C=T,D=F)
+ P(A,B,C=F,D=T) + P(A,B,C=F,D=F)
Problem:
The highlighted terms both compute P(A,B,C=T) and then multiply by different D values!
This is redundant — we're computing the same sub-expression multiple times.
The Key Transformation
Step 1
Enumeration: Expand Everything
P(B,A) = ΣC,D P(A,B,C,D)
Sum over all combinations of C and D
Step 2
Factor by Chain Rule
= ΣC,D P(A)·P(B|A)·P(C|B)·P(D|C)
Break joint into conditional probabilities
Step 3
Push Summations Inside
= P(A)·P(B|A)·ΣC P(C|B)·[ΣD P(D|C)]
Group terms that don't depend on outer variables
Step 4
Result: Product of Factors
= f1 × f2 × f3
Where:
f1 = P(A) · P(B|A)
f2 = ΣD P(D|C) (after eliminating D)
f3 = ΣC P(C|B) · f2 (after eliminating C)
Each factor is computed once and reused
Side-by-Side Comparison
Enumeration
P(B,A) = P(A,B,C=T,D=T)
+ P(A,B,C=T,D=F)
+ P(A,B,C=F,D=T)
+ P(A,B,C=F,D=F)
Computation: 4 full joint probabilities
Redundancy: Computes P(A,B,C) twice!
Variable Elimination
P(B,A) = P(A,B,C=T) × [P(D=T) + P(D=F)]
+ P(A,B,C=F) × [P(D=T) + P(D=F)]
Computation: Eliminate D first (ΣD = 1)
Efficiency: Computes P(A,B,C) once!
The Big Insight
Enumeration computes the same intermediate results many times because it sums over all variables simultaneously.
Variable Elimination computes each intermediate result exactly once by:
- Rearranging summations to eliminate variables one at a time
- Storing intermediate factors and reusing them
- Dynamic programming on the computational graph