Exact & Approximate Inference in Bayesian Networks
“Inference by enumeration, Variable Elimination factor algebra, and Likelihood Weighting sampling.”
1.The Probabilistic Inference Task
§ 5.1.The fundamental inference query in a Bayesian Network consists of:
• Query Variable X: The target variable whose posterior distribution we wish to compute.
• Evidence Variables E = {E_1, ..., E_k}: Variables observed to have specific instantiated values e = {e_1, ..., e_k}.
• Hidden Variables Y = {Y_1, ..., ..., Y_m}: All remaining unobserved non-query variables in the network (Y = Variables \setminus ({X} \cup E)).
We compute P(X \mid E = e) by marginalizing out all hidden variables:
$P(X \mid E = e) = \alpha P(X, E = e) = \alpha \sum_{y_1} \sum_{y_2} ... \sum_{y_m} P(X, e, y_1, y_2, ..., y_m)$
Where \alpha = \frac{1}{P(E = e)} = \frac{1}{\sum_x P(X = x, E = e)} is the normalization constant.
2.The Variable Elimination (VE) Algorithm
§ 5.2.Enumeration repeats identical sub-calculations exponentially many times. Variable Elimination computes the sum efficiently by moving summations inside products (algebraic distributive law ab + ac = a(b + c)).
Core Operations on Factors:
1. Pointwise Factor Product: Multiplying two factors \phi_1(A, B) and \phi_2(B, C) yields a new factor \phi_3(A, B, C) = \phi_1(A, B) \cdot \phi_2(B, C).
2. Summing Out (Marginalization): Summing out variable B from factor \phi_3(A, B) yields a reduced factor \phi_4(A) = \sum_b \phi_3(A, B = b).
Variable Elimination Protocol:
1. Collect all initial CPTs as factors \Phi.
2. Set instantiated evidence values E = e across all factors.
3. Choose an elimination ordering for hidden variables Y_1, Y_2, ..., Y_m.
4. For each hidden variable Y_j:
• Remove from \Phi all factors mentioning Y_j.
• Multiply these factors together into a single composite factor.
• Sum out Y_j from this factor.
• Insert the resulting factor back into \Phi.
5. Multiply remaining factors containing query X and normalize by \alpha.
3. GATE DA Worked Numerical: Exact Inference Calculation
Be sure to normalize at the end so probabilities P(X=true|e) + P(X=false|e) = 1!
Problem (Original Practice Problem · Modeled on GATE DA Pattern):
Consider a 3-node Bayesian Network: Cloud -> Rain -> Traffic (C -> R -> T).
Given CPT probabilities:
P(C = true) = 0.5
P(R = true | C = true) = 0.8; P(R = true | C = false) = 0.2
P(T = true | R = true) = 0.9; P(T = true | R = false) = 0.1
Calculate P(C = true | T = true).
Step 1: Formulate the unnormalized joint query:
P(C, T = true) = sum_{r in {true, false}} P(C) P(R = r | C) P(T = true | R = r)
Step 2: Compute for C = true:
P(C=t, T=t) = P(C=t) [ P(R=t|C=t) P(T=t|R=t) + P(R=f|C=t) * P(T=t|R=f) ]
P(C=t, T=t) = 0.5 [ (0.8 0.9) + (0.2 * 0.1) ]
P(C=t, T=t) = 0.5 [ 0.72 + 0.02 ] = 0.5 0.74 = 0.37.
Step 3: Compute for C = false:
P(C=f, T=t) = P(C=f) [ P(R=t|C=f) P(T=t|R=t) + P(R=f|C=f) * P(T=t|R=f) ]
P(C=f, T=t) = 0.5 [ (0.2 0.9) + (0.8 * 0.1) ]
P(C=f, T=t) = 0.5 [ 0.18 + 0.08 ] = 0.5 0.26 = 0.13.
Step 4: Normalize by total evidence probability P(T = true):
P(T = true) = 0.37 + 0.13 = 0.50.
P(C = true | T = true) = 0.37 / 0.50 = 0.74.
P(C = false | T = true) = 0.13 / 0.50 = 0.26.
Conclusion: P(C = true | T = true) = 0.74 (74%).
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.