程序代写代做代考 Tutorial Examples Uncertainty

Tutorial Examples Uncertainty
November 27, 2020

Inference in Bayes Nets
EB
S
WG
P(E,S,B,W,G) = P(E)P(B)P(S|E,B)P(W|S)P(G|S)

Inference in Bayes Nets
P(E)
P(S|E,B)
e
-e
9/10
P(B)
b
-b
1/10
1/10
9/10
s
-s
P(W|S)
w
-w
e∧b
9/10
1/10
s
8/10
2/10
e ∧ -b
2/10
8/10
-s
2/10
8/10
-e ∧ b
8/10
2/10
-e ∧ -b
0
1
P(G|S)
g
-g
s
1/2
1/2
-s
0
1

Inference in Bayes Nets
􏰀 Given the alarm went off (s) what is the probability that Mrs. Gibbons phones you (g)?

Inference in Bayes Nets
􏰀 Given the alarm went off (s) what is the probability that Mrs. Gibbons phones you (g)? probability that the alarm went off (s)?
P(g|s) = 1/2

Inference in Bayes Nets
􏰀 Given that Mrs. Gibbons phones you (g) what is the probability the alarm went off (s)?

Inference in Bayes Nets
􏰀 Given that Mrs. Gibbons phones you (g) what is the probability the alarm went off (s)?
1. Bayes Rule says: P(S|g) = P(g|S) ∗ P(S)/P(g)
2. P(−s|g) = P(g| − s) ∗ P(−s)/P(g) = 0 ∗ P(−s)/P(g) = 0. 3. Therefore P(s|g) = 1 (P(s|g) + P(−s|g) must sum to 1.
P(s|g) = 1 P(−s|g) = 0 Alternatively: −s → −g, so g → s, so P(s|g) = 1.

Inference in Bayes Nets
􏰀 Say that there was a burglary (b) and but no earthquake (-e), what is the expression specifying the posterior probability of Dr. Watson phoning you (w) given the evidence. (You do not need to calculate a numeric answer, just give the probability expression).

Inference in Bayes Nets
􏰀 Say that there was a burglary (b) and but no earthquake (-e), what is the expression specifying the posterior probability of Dr. Watson phoning you (w) given the evidence. (You do not need to calculate a numeric answer, just give the probability expression).
P(w|b,−e)

Inference in Bayes Nets
􏰀 What is P(G|S)? (i.e., the four probability values) P(g|s), P(−g|s), P(g| − s), P(−g| − s).

Inference in Bayes Nets
􏰀 What is P(G|S)? (i.e., the four probability values P(g|s), P(−g|s), P(g| − s), P(−g| − s).
P(g|s) = 1/2 P(−g|s) = 1/2 P(−g|−s)=0 P(−g|−s)=1

Inference in Bayes Nets
􏰀 What is P (G |S ∧ W )? (i.e., the 8 probability values P(g|s ∧w), P(g|s ∧−w), …, P(−g|−s ∧−w)).

Inference in Bayes Nets
􏰀 What is P (G |S ∧ W )? (i.e., the 8 probability values P(g|s ∧w), P(g|s ∧−w), …, P(−g|−s ∧−w)).
P(g|s, −w) = P(g|s, w) = P(g|s) = 1/2 P(−g|s, −w) = P(−g|s, w) = P(−g|s) = 1/2 P(g|−s,−w) = P(g|−s,w) = P(g|−s) = 0 P(−g|−s,−w) = P(−g|−s,w) = P(g|−s) = 1

Inference in Bayes Nets
􏰀 What do these values tell us about the relationship between G, W and S?
G is conditionally independent of W given S

Inference in Bayes Nets
􏰀 What is P(G|W)? (i.e., the four probability values P(g|w), P(−g|w), P(g| − w), and P(−g| − w)).

Inference in Bayes Nets
􏰀 What is P(G|W)? (i.e., the four probability values P(g|w), P(−g|w), P(g| − w), and P(−g| − w)).
Must do variable elimination.

Inference in Bayes Nets
􏰀 What is P(G|W)? (i.e., the four probability values P(g|w), P(−g|w), P(g| − w), and P(−g| − w)).
􏰀 Query variable is G.
􏰀 First run of VE, evidence is W = w.
􏰀 Second run of VE, evidence is W = −w.
􏰀 Use same ordering for both runs of VE: E, B, S, G.
􏰀 With same ordering some factors can be reused between the two runs of VE.

Inference in Bayes Nets
􏰀 What is P(G|W)? (i.e., the four probability values P(g|w), P(−g|w), P(g| − w), and P(−g| − w)).
1. E: P(E), P(S|E,B) 2. B: P(B),
3. S: P(w|S), P(S|G) 4. G:

Inference in Bayes Nets
􏰀 What is P(G|W)? (i.e., the four probability values P(g|w), P(−g|w), P(g| − w), and P(−g| − w)).
1. E: P(E), P(S|E,B) 2. B: P(B),
3. S: P(w|S), P(S|G)
4. G:
F1(S,B) = 􏰁E P(E)×P(S|E,B)
= P(e)×P(S|e,B)+P(−e)×P(S|−e,B)
F1(−s,−b) =
= 0.1×0.8+0.9×1 = 0.98
P(e)P(−s, e, −b) + P(−e)P(−s, −e, −b)
F1(−s,b) =
= 0.1×0.1+0.9×0.2 = 0.19
P(e)P(−s, e, b) + P(−e)P(−s, −e, b)
F1(s,−b) =
= 0.1×0.2+0.9×0 = 0.02
P(e)P(s, e, −b) + P(−e)P(s, −e, −b)
P(e)P(s, e, b) + P(−e)P(s, −e, b)
F1(s,b) =
= 0.1×0.9+0.9×0.8 = 0.81

Inference in Bayes Nets
1. E: P(E), P(S|E,B) 2. B: P(B), F1(S,B)
3. S: P(w|S), P(S|G) 4. G:
F2(S) = =
F2(−s) = = F2(s) = =
􏰁B P(B)×F1(S,B)
P(b)F1(S, b) + P(−b)F1(S, −b)
P(b)F1(−s, b) + P(−b)F1(−s, −b) 0.1×0.19+0.9×0.98 = 0.901 P(b)F1(s, b) + P(−b)F1(s, −b) 0.1×0.81+0.9×0.02 = 0.099

Inference in Bayes Nets
1. E: P(E), P(S|E,B) 2. B: P(B), F1(S,B)
3. S: P(w|S), P(S|G), F2(S) 4. G:
􏰁S P(w|S) × P(S|G) × F2(S)
F3(G) =
= P(w|s)P(s|G)F2(s) + P(w| − s)P(−s|G)F2(−s)
F3(−g) =
= 0.8×0.5×0.099+0.2×1×0.901 = 0.2198
P(w|s)P(s| − g)F2(s) + P(w| − s)P(−s| − g)F2(−s)
P(w|s)P(s|g)F2(s) + P(w| − s)P(−s|g)F2(−s)
F3(g) =
= 0.8×0.5×0.099+0.2×0×0.901 = 0.0396

Inference in Bayes Nets
1. E: P(E), P(S|E,B) 2. B: P(B), F1(S,B)
3. S: P(w|S), P(S|G), F2(S) 4. G: F3(G)
Normalize F3(G):
P(−g|w) =
P(g|w) =
0.2198 = 0.8473 0.2198+0.0396
0.0396 = 0.1527 0.2198+0.0396

Inference in Bayes Nets
􏰀 NowP(G|−w)?
1. E: P(E), P(S|E,B) 2. B: P(B),
3. S: P(−w|S), P(S|G) 4. G:
Already computed as F1(S,B)

Inference in Bayes Nets
1. E: P(E), P(S|E,B) 2. B: P(B), F1(S,B)
3. S: P(−w|S), P(S|G) 4. G:
Already computed as F2(S)

Inference in Bayes Nets
1. E: 2. B: 3. S: 4. G:
F3(G) = =
F3(−g) = = F3(g) = =
P(E), P(S|E,B)
P(B), F1(S,B) P(−w|S), P(S|G), F2(S)
􏰁S P(−w|S) × P(S|G) × F2(S) P(−w|s)P(s|G)F2(s) + P(−w| − s)P(−s|G)F2(−s)
P(−w|s)P(s| − g)F2(s) + P(−w| − s)P(−s| − g)F2(−s) 0.2×0.5×0.099+0.8×1×0.901 = 0.7307 P(−w|s)P(s|g)F2(s) + P(−w| − s)P(−s|g)F2(−s) 0.2×0.5×0.099+0.8×0×0.901 = 0.0099

Inference in Bayes Nets
1. E: P(E), P(S|E,B) 2. B: P(B), F1(S,B)
3. S: P(−w|S), P(S|G), F2(S) 4. G: F3(G)
Normalize F3(G):
P(−g| − w) = 0.7307
P(g| − w) = 0.0099 0.2198+0.00099
0.7307+0.0099
= 0.9866
= 0.0134

Inference in Bayes Nets
􏰀 What do these values tell us about the relationship between G and W , and why does this relationship differ when we know S?

Inference in Bayes Nets
􏰀 What do these values tell us about the relationship between G and W , and why does this relationship differ when we know S?
G and W are not independent of each other. But when S is known they become independent.