Bayesian Neworks
Bayesian Neworks
Bayesian Networks
• A Bayesian network specifies a joint distribution in a structured form
p(A,B,C) = p(C|A,B)p(A)p(B)
A B C Marginal Independence:
p(A,B,C) = p(A) p(B) p(C)
Examples of 3-way Bayesian Networks
A B Independent Causes:
p(A,B,C) = p(C|A,B)p(A)p(B)
C
“Explaining away” effect:
Given C, observing A makes B less likely
e.g., earthquake/burglary/alarm example
A B C Markov dependence:
p(A,B,C) = p(C|B) p(B|A)p(A)
Example
• Consider the following 5 binary variables:
– B = a burglary occurs at your house
– E = an earthquake occurs at your house
– A = the alarm goes off
– J = John calls to report the alarm
– M = Mary calls to report the alarm
• P(J, M, A, E, B) =
P(J | A) P(M | A) P(A | E, B) P(E) P(B)
• Example
– Full unconstrained joint distribution
• n = 30: need 109 probabilities for full joint distribution
– Bayesian network
• n = 30, k = 4: need 480 probabilities
The Bayesian Network from a different Variable Ordering
The Bayesian Network from a different Variable Ordering
Given a graph, can we “read off” conditional independencies?
• Examples
– P(burglary | alarm)
B E
A C F G
B E
A c F g
B E
A c F g
B E
A c F g
Reordering:
Sd p(a|b) Sd p(b|d,c) Se p(d|e) Sf p(e,f |g)
Example
D
B E
A c F g
Reordering:
Sb p(a|b) Sd p(b|d,c) Se p(d|e) Sf p(e,f |g)
p(e|g)
Example
D
B E
A c F g
Reordering:
Sb p(a|b) Sd p(b|d,c) Se p(d|e) p(e|g)
p(d|g)
Example
D
B E
A c F g
Reordering:
Sb p(a|b) Sd p(b|d,c) p(d|g)
p(b|c,g)
Example
D
B E
A c F g
Reordering:
Sb p(a|b) p(b|c,g)
p(a|c,g) Complexity is O(m), compared to O(m4)
General Strategy for inference
• Want to compute P(q | e)
Step 1:
P(q | e) = P(q,e)/P(e) = a P(q,e), since P(e) is constant wrt Q
Step 2:
P(q,e) = Sa..z P(q, e, a, b, …. z), by the law of total probability
Step 3:
Sa..z P(q, e, a, b, …. z) = Sa..z i P(variable i | parents i)
(using Bayesian network factoring)
Step 4:
Distribute summations across product terms for efficient computation
Complexity of Bayesian Network
inference
• Assume the network is a polytree
– Only a single directed path between any 2 nodes
– But for many variables there is little know beyond their univariate
properties, e.g., what would be the joint distribution of a Poisson and a
Gaussian? (its not defined)