100% found this document useful (1 vote)
73 views4 pages

Solving Bayesian Network Problems

The document provides examples and explanations of Bayesian networks. It contains 5 problems that involve: 1) Writing the joint probability table for a simple Bayesian network about having the flu and coughing. 2) Analyzing which of two Bayesian networks about burglary alarms makes incorrect independence assumptions. 3) Determining whether variables in several Bayesian networks are necessarily independent given evidence. 4) Calculating the probability of an output variable given evidence in a Bayesian network. 5) Constructing a Bayesian network where two variables are independent if an intermediate variable is unknown.

Uploaded by

prateek.cs20
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
73 views4 pages

Solving Bayesian Network Problems

The document provides examples and explanations of Bayesian networks. It contains 5 problems that involve: 1) Writing the joint probability table for a simple Bayesian network about having the flu and coughing. 2) Analyzing which of two Bayesian networks about burglary alarms makes incorrect independence assumptions. 3) Determining whether variables in several Bayesian networks are necessarily independent given evidence. 4) Calculating the probability of an output variable given evidence in a Bayesian network. 5) Constructing a Bayesian network where two variables are independent if an intermediate variable is unknown.

Uploaded by

prateek.cs20
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Problem 1: Joint and Conditional Probabilities in Bayesian Networks
  • Problem 2: Analyzing Alarm Systems in Bayesian Networks
  • Problem 3: Independence and Paths in Bayesian Networks
  • Problem 5: Dependency Conditions in Bayesian Networks
  • Problem 4: Boolean Random Variables in Bayesian Networks

Bayesian Networks– Solution

1) Consider the following Bayesian network, where F = having the flu and C =
coughing:
P(C | F) = 0.8
P(F) = 0.1 F C
P(C |  F) = 0.3

a) Write down the joint probability table specified by the Bayesian network.
Answer:
F C
t t 0.1 × 0.8 = 0.08
t f 0.1 × 0.2 = 0.02
f t 0.9 × 0.3 = 0.27
f f 0.9 × 0.7 = 0.63
b) Determine the probabilities for the following Bayesian network
C F

so that it specifies the same joint probabilities as the given one.


Answer:
P(C) = 0.08 + 0.27 = 0.35
P(F | C) = P(F, C) / P(C) = 0.08/0.35 ∼ 0.23
P(F | ¬ C) = P(F, ¬ C) / P(¬ C) = 0.02/0.65 ∼ 0.03
c) Which Bayesian network would you have specified using the rules learned in
class?
Answer:
The first one. It is good practice to add nodes that correspond to causes before
nodes that correspond to their effects.
d) Are C and F independent in the given Bayesian network?
Answer:
No, since (for example) P(F) = 0.1 but P(F | C) ∼ 0.23
e) Are C and F independent in the Bayesian network from Question b?
Answer:
No, for the same reason.
2) To safeguard your house, you recently installed two different alarm systems by
two different reputable manufacturers that use completely different sensors for
their alarm systems.
a) Which one of the two Bayesian networks given below makes independence
assumptions that are not true? Explain all of your reasoning. Alarm1 means
that the first alarm system rings, Alarm2 means that the second alarm system
rings, and Burglary means that a burglary is in progress.

(1) Burglary (2) Alarm1 Alarm2

Alarm1 Alarm2 Burglary

Answer:
The second one falsely assumes that Alarm1 and Alarm2 are independent if the
value of Burglary is unknown. However, if the alarms are working as intended,
it should be more likely that Alarm1 rings if Alarm2 rings (that is, they should
not be independent).
b) Consider the first Bayesian network. How many probabilities need to be
specified for its conditional probability tables? How many probabilities would
need to be given if the same joint probability distribution were specified in a
joint probability table?
Answer:
We need to specify 5 probabilities, namely P(Burglary), P(Alarm1 | Burglary),
P(Alarm1 | ¬ Burglary), P(Alarm2 | Burglary) and P(Alarm2 | ¬ Burglary).
A joint probability table would need 23 − 1 = 7 probabilities.
c) Consider the second Bayesian network. Assume that:
P(Alarm1) = 0.1
P(Alarm2) = 0.2
P(Burglary | Alarm1, Alarm2) = 0.8
P(Burglary | Alarm1, ¬ Alarm2) = 0.7
P(Burglary | ¬ Alarm1, Alarm2) = 0.6
P(Burglary | ¬ Alarm1, ¬ Alarm2) = 0.5
Calculate P(Alarm2 | Burglary, Alarm1). Show all of your reasoning.
Answer:
P(Alarm2 | Burglary, Alarm1) = P(Alarm1, Alarm2, Burglary) / P(Burglary,
Alarm1) = 0.016/0.072 ∼ 0.22
with
P(Alarm1, Alarm2, Burglary) = P(Alarm1) P(Alarm2) P(Burglary | Alarm1,
Alarm2) = 0.1 × 0.2 × 0.8 = 0.016
P(Alarm1, ¬ Alarm2, Burglary) = P(Alarm1) P(¬ Alarm2) P(Burglary | Alarm1,
¬ Alarm2) = 0.1 × 0.8 × 0.7 = 0.056
P(Burglary, Alarm1) = P(Alarm1, Alarm2, Burglary) + P(Alarm1, ¬ Alarm2,
Burglary) = 0.016 + 0.056 = 0.072
3) Consider the following Bayesian network:
A B

D E

F G

a) Are D and E necessarily independent given evidence about both A and B?


Answer:
No. The path D-C-E is not blocked.
b) Are A and C necessarily independent given evidence about D?
Answer:
No. They are directly dependent. The path A-C is not blocked.
c) Are A and H necessarily independent given evidence about C?
Answer:
Yes. All paths from A to H are blocked.

4) Consider the following Bayesian network. A, B, C, and D are Boolean random


variables. If we know that A is true, what is the probability of D being true?
A P(A) = 0.75

P(B | A) = 0.2 P(C | A) = 0.7


B C P(C |  A) = 0.25
P(B |  A) = 0.5

P(D | B  C) = 0.3
P(D | B   C) = 0.25
P(D |  B  C) = 0.1
P(D |  B   C) = 0.35

Answer:
P(D|A) = P(A, D) / P(A)
= (P(A, B, C, D) + P(A, B, ¬ C, D) + P(A, ¬ B, C, D) + P(A, ¬ B, ¬ C,
D)) / P(A)
= P(B | A) P(C | A) P(D | B, C) + P(B | A) P(¬ C | A) P(D | B, ¬ C) +
P(¬ B | A) P(C | A) P(D | ¬ B, C) + P(¬ B | A) P(¬ C | A) P(D | ¬ B, ¬ C)
= (0.2 × 0.7 × 0.3) + (0.2 × 0.3 × 0.25) + (0.8 × 0.7 × 0.1) + (0.8 × 0.3 ×
0.35)
= 0.042 + 0.015 + 0.056 + 0.084
= 0.197

5) For the following Bayesian network


Y

X Z

we know that X and Z are not guaranteed to be independent if the value of Y


is unknown. This means that, depending on the probabilities, X and Z can be
independent or dependent if the value of Y is unknown. Construct probabilities
where X and Z are independent if the value of Y is unknown, and show that
they are indeed independent.
Answer:
Y P(Y) = 0.5

P(X | Y) = 0.5 P(Z | Y) = 0.5


P(X |  Y) = 0.5 X Z P(Z |  Y) = 0.5

P(X) = P(Y) P(X | Y) + P(¬ Y) P(X | ¬ Y) = 0.5 × 0.5 + 0.5 × 0.5 = 0.5
P(Z) = P(Y) P(Z | Y) + P(¬ Y) P(Z | ¬ Y) = 0.5 × 0.5 + 0.5 × 0.5 = 0.5
P(X, Z) = P(X, Y, Z) + P(X, ¬ Y, Z)
= P(Y) P(X | Y) P(Z | Y) + P(¬ Y) P(X | ¬ Y) P(Z | ¬Z)
= 0.5 × 0.5 × 0.5 + 0.5 × 0.5 × 0.5 = 0.25
Therefore, P(X) P(Z) = P(X,Z). We can similarly show that P(X) P(¬ Z) =
P(X, ¬ Z), P(¬ X) P(Z) = P(¬ X, Z) and P(¬ X) P(¬ Z) = P(¬ X, ¬ Z) to
prove that X and Z are independent if the value of Y is unknown.

Common questions

Powered by AI

The probability of D being true given A is true, P(D|A), is computed as 0.197. It is found by summing probabilities of all paths leading to D being true under given conditions for A and their respective junction probabilities: P(B|A)P(C|A)P(D|B,C) + P(B|A)P(¬C|A)P(D|B,¬C) + P(¬B|A)P(C|A)P(D|¬B,C) + P(¬B|A)P(¬C|A)P(D|¬B,¬C)

The mistake in the second Bayesian network is that it assumes Alarm1 and Alarm2 are independent if Burglary is unknown. However, because the alarm systems are designed to detect the same event, one alarm sounding should increase the likelihood that the other will also sound, making them dependent.

X and Z are independent if the influence passing through Y is made to have no net effect. Probabilities are assigned such that P(X)P(Z) equals P(X,Z), where P(Y), P(X|Y), P(Z|Y) are all set to 0.5, ensuring that the marginal effects of Y's variability on X and Z cancel each other out.

A and H are independent given evidence about C because all paths from A to H are blocked by C. With C known, any information passing between A and H through other paths is effectively cut off, ensuring independence.

D and E are not necessarily independent given evidence about A and B because the path D-C-E is unblocked, allowing influence to pass between D and E. Thus, knowing A and B does not block the explanatory path, hence they can influence each other.

Two variables in a Bayesian network are independent if observing one does not affect the probability of the others. For example, variables C (coughing) and F (having the flu) in the given network are not independent because P(F) differs from P(F|C). Specifically, P(F)=0.1 while P(F|C)~0.23, indicating dependence.

To generate the joint probability table, calculate the probabilities for each combination of F and C: (1) F=true, C=true: P(F)P(C|F) = 0.1 * 0.8 = 0.08. (2) F=true, C=false: P(F)P(¬C|F) = 0.1 * 0.2 = 0.02. (3) F=false, C=true: P(¬F)P(C|¬F) = 0.9 * 0.3 = 0.27. (4) F=false, C=false: P(¬F)P(¬C|¬F) = 0.9 * 0.7 = 0.63.

For the Bayesian network with Burglary and two alarms, you need to specify 5 probabilities: P(Burglary), P(Alarm1|Burglary), P(Alarm1|¬Burglary), P(Alarm2|Burglary), and P(Alarm2|¬Burglary). Meanwhile, specifying a joint probability table for the same distribution without structural dependencies would require 7 probabilities.

To calculate P(Alarm2 | Burglary, Alarm1), use the formula: P(Alarm2 | Burglary, Alarm1) = P(Alarm1, Alarm2, Burglary) / P(Burglary, Alarm1) = 0.016/0.072 ≈ 0.22. It's computed as: P(Alarm1, Alarm2, Burglary) = 0.1 * 0.2 * 0.8 = 0.016 and P(Burglary, Alarm1) = 0.016 + 0.056 = 0.072.

Bayesian Networks– Solution
1) Consider the following Bayesian network, where F = having the flu and C =
coughing:
C
F
P(F) =
that the first alarm system rings, Alarm2 means that the second alarm system
rings, and Burglary means that a burglary is in p
3) Consider the following Bayesian network:
E
G
C
D
F
H
B
A
a) Are D and E necessarily independent given evidence about both
P(¬ B | A) P(C | A) P(D | ¬ B, C) + P(¬ B | A) P(¬ C | A) P(D | ¬ B, ¬ C)
= (0.2 × 0.7 × 0.3) + (0.2 × 0.3 × 0.25) + (0.8 × 0

You might also like