Four binary variables: Cloudy, Sprinkler, Rain and Wet grass. The joint distribution factorises along the graph as \(p(C)\,p(S\mid C)\,p(R\mid C)\,p(W\mid S,R)\). Choose what you have observed and the page computes every other node's posterior probability exactly, by summing the sixteen joint probabilities consistent with the evidence. Observe wet grass and rain becomes likelier; also observe that the sprinkler is on and rain becomes less likely again: the two causes compete to explain the same effect.
Default tables as in Figure 3.14: p(C = T) = 0.5; p(S = T | C) = 0.5 (C = F), 0.1 (C = T); p(R = T | C) = 0.2, 0.8; p(W = T | S, R) = 0, 0.9, 0.9, 0.99 for (S, R) = (F,F), (T,F), (F,T), (T,T). Posteriors are exact; nothing is sampled.
code/ch03_probability_multivariate.py (sprinkler_joint, sprinkler_posterior).