Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 24 — Assignment Project: Inference When Enumeration Is Impossible

Open in Colab

Overview

A monitoring system is modelled by a Bayesian network of 40 binary variables (alarms, sensors, faults), generated below. Enumerating its 240 assignments is out of the question. You will compute exact answers by variable elimination, then compare three approximate methods against them, and recommend one.

PartTaskPoints
AExact answers and the cost of an order20
BLikelihood weighting20
CGibbs sampling25
DAccuracy against time20
ERecommendation15

Part A — Exact Answers and the Cost of an Order (20 points)

  1. Compute the three queries exactly with variable elimination, using a min-degree order. Report the answers, the largest factor and the time.

  2. For the first query, also try the topological order and the reverse topological order. Explain the differences in cost.

Your explanation:


Part B — Likelihood Weighting (20 points)

Implement likelihood weighting for this network and estimate the three queries with 1 000, 10 000 and 50 000 samples. Report the absolute errors against Part A, and the effective number of samples (∑w)2/∑w2(\sum w)^2 / \sum w^2 for each query.


Part C — Gibbs Sampling (25 points)

Implement Gibbs sampling for this network (resample every non-evidence variable from its Markov blanket, in each sweep). For the first query, run three chains of 5 000 sweeps from random starts, with 500 sweeps of burn-in. Plot their running estimates against the exact answer, and report each chain’s final error.


Part D — Accuracy Against Time (20 points)

For the three queries, give each method about the same time budget (for example 3 seconds): how large is each one’s error? Present a table, and explain the differences.

Your table and explanation:


Part E — Recommendation (15 points)

The monitoring team will run thousands of such queries a day, on networks of 40 to 200 variables. Which method would you recommend, under which conditions would you switch, and how would they check, in production, that the answers are trustworthy?

Grading Rubric

CriterionExcellentAdequateInsufficient
A (20)exact answers; the cost of orders explained with factor sizesanswers onlymissing
B (20)errors and effective samples, interpretederrors onlymissing
C (25)three chains, plot, burn-in, agreement discussedone chainmissing
D (20)a fair comparison under the same budget, explainednumbers onlymissing
E (15)a justified choice with switching conditions and checksgenericmissing