Intelligent Systems II · TEE · mocks

Q3(a) Bayesian network: wet grass given no rain [10]

Final examination · 24 Nov 2025

100-mark timed practice using the actual Final 2025 paper. Q1 compulsory; any four of Q2–Q7. Worked solutions are below the questions.

Question. Cloudy → Sprinkler, Cloudy → Rain, Sprinkler and Rain → Wet Grass. P(Cloudy) = 0.5; P(Sprinkler | C) = 0.10, P(Sprinkler | ¬C) = 0.50; P(Rain | C) = 0.80, P(Rain | ¬C) = 0.20; P(Wet | S, R) = 0.99, P(Wet | S, ¬R) = 0.90, P(Wet | ¬S, R) = 0.90, P(Wet | ¬S, ¬R) = 0.01. Calculate the probability of the grass being wet given it doesn't rain. [10 marks]

Answer

The following table enumerates the values of Cloudy and Sprinkler that were not fixed by the question. Two Boolean choices give four rows: true/true, true/false, false/true, false/false. Each row is one mutually exclusive complete case. Read the CPT entry using that row’s parent values, multiply its factors, and add the resulting row weights. The denominator must include all cases matching the evidence, including both possible values of the queried outcome.

Given

C→S, C→R, (S,R)→W. Root and conditional probabilities are listed in the question. Evidence R=false.

To find

P(W=true | R=false). Hidden variables C and S must be summed out.

Formula and why it applies

Use the network joint and divide by the evidence probability.

P(W\mid\neg R)=\frac{\sum_{c,s}P(c)P(s\mid c)P(\neg R\mid c)P(W\mid s,\neg R)}{\sum_cP(c)P(\neg R\mid c)}LaTeX: P(W\mid\neg R)=\frac{\sum_{c,s}P(c)P(s\mid c)P(\neg R\mid c)P(W\mid s,\neg R)}{\sum_cP(c)P(\neg R\mid c)}

Solution

Swipe across the diagram to read its labels ↔
Final 2025 Q3a: sprinkler network
Diagram: Final 2025 Q3a: sprinkler network. Labels: Final 2025 Q3a: sprinkler network | Cloudy | P(C) = 0.5 | Sprinkler | P(S|C) = 0.1, P(S|¬C) = 0.5 | Rain | P(R|C) = 0.8, P(R|¬C) = 0.2 | Wet grass | P(W|S,R): .99 · .90 · .90 · .01 | (TT · TF · FT · FF)
Step 1. Joint by the chain rule
P(C,S,R,W)=P(C)\,P(S\mid C)\,P(R\mid C)\,P(W\mid S,R)LaTeX: P(C,S,R,W)=P(C)\,P(S\mid C)\,P(R\mid C)\,P(W\mid S,R)
Step 2. Sum over C and S with R = false, W = true
CSP(C)P(S|C)P(¬R|C)P(W|S,¬R)Product
TT0.50.10.20.900.0090
TF0.50.90.20.010.0009
FT0.50.50.80.900.1800
FF0.50.50.80.010.0020
P(W, ¬R)0.1919
Step 3. Evidence
P(\lnot R)=P(C)P(\lnot R\mid C)+P(\lnot C)P(\lnot R\mid\lnot C)=0.5(0.2)+0.5(0.8)=0.5LaTeX: P(\lnot R)=P(C)P(\lnot R\mid C)+P(\lnot C)P(\lnot R\mid\lnot C)=0.5(0.2)+0.5(0.8)=0.5
Step 4. Divide
P(W\mid\lnot R)=\frac{0.1919}{0.5}=0.3838LaTeX: P(W\mid\lnot R)=\frac{0.1919}{0.5}=0.3838
Final answer. P(grass wet | no rain) ≈ 0.384. Without rain, the grass is wet mainly when the sprinkler runs (more likely on non-cloudy days).
Keep the requested conditional probability separate. The supplied key discusses P(Wet) and P(Rain | Wet), whereas this question asks P(Wet | no rain). The answer to the printed question is 0.3838. For comparison, the exact marginal from the printed CPT is calculated below; it is not 0.6505.

Optional comparison: calculate P(Wet) from the same network

The four no-rain cases already total 0.1919. Now add the four rain cases, keeping the same Cloudy/Sprinkler order.

P(W,R)=0.5(0.1)(0.8)(0.99)+0.5(0.9)(0.8)(0.90)+0.5(0.5)(0.2)(0.99)+0.5(0.5)(0.2)(0.90)LaTeX: P(W,R)=0.5(0.1)(0.8)(0.99)+0.5(0.9)(0.8)(0.90)+0.5(0.5)(0.2)(0.99)+0.5(0.5)(0.2)(0.90)
P(W,R)=0.0396+0.324+0.0495+0.045=0.4581LaTeX: P(W,R)=0.0396+0.324+0.0495+0.045=0.4581
P(W)=P(W,R)+P(W,\neg R)=0.4581+0.1919=0.6500LaTeX: P(W)=P(W,R)+P(W,\neg R)=0.4581+0.1919=0.6500
P(R\mid W)=\frac{0.4581}{0.6500}\approx0.704769231LaTeX: P(R\mid W)=\frac{0.4581}{0.6500}\approx0.704769231

Meaning: the unconditional chance of Wet is 0.65, the chance of Rain among wet cases is about 0.704769, and the requested chance of Wet among no-rain cases is 0.3838. These are three different questions.

Trap. Do not plug in the marginal P(Sprinkler) = 0.3; sprinkler and rain both depend on Cloudy, so you must sum over Cloudy (given no rain, P(S) = 0.42).