Probabilistic Reasoning
LESSON 12
Reading
Chapter 14
3/21/2016 503043 - PROBABILISTIC REASONING 2
Outline
Syntax of Bayesian networks
Semantics of Bayesian networks
Efficient representation of conditional distributions
Exact inference by enumeration
Exact inference by variable elimination
Approximate inference by stochastic simulation*
Approximate inference by Markov Chain Monte Carlo*
3/21/2016
3
503043 - PROBABILISTIC REASONING
Motivations
Full joint probability distribution can answer any
question but can become intractably large as
number of variable increases
Specifying probabilities for atomic events can be
difficult, e.g., large set of data, statistical estimates,
etc.
Independence and conditional independence reduce
the probabilities needed for full joint probability
distribution.
3/21/2016 503043 - PROBABILISTIC REASONING 4
Bayesian networks
A directed, acyclic graph (DAG)
A set of nodes, one per variable (discrete or continuous)
A set of directed links (arrows) connects pairs of nodes. X is a parent
of Y if there is an arrow (direct influence) from node X to node Y.
Each node X i has a conditional probability distribution
that quantifies the effect of the parents on the node.
Combinations of the topology and the conditional distributions
specify (implicitly) the full joint distribution for all the variables.
P X i | Parents ( X i )
3/21/2016
5
503043 - PROBABILISTIC REASONING
Bayesian networks
Example 1: The Teeth Disease Bayesian
3/21/2016
6
503043 - PROBABILISTIC REASONING
Example: Burglar alarm system
I have a burglar alarm installed at home
It is fairly reliable at detecting a burglary, but also responds on
occasion to minor earth quakes.
I also have two neighbors, John and Mary
They have promised to call me at work when they hear the alarm
John always calls when he hears the alarm, but sometimes confuses
the telephone ringing with the alarm and calls then, too.
Mary likes rather loud music and sometimes misses the alarm
altogether.
Bayesian networks variables:
Burglar, Earthquake, Alarm, JohnCalls, MaryCalls
3/21/2016 7
Example: Burglar alarm system
Network topology reflects “causal” knowledge:
A burglar can set the alarm off
An earthquake can set the alarm off
The alarm can cause Mary to call
The alarm can cause John to call
conditional probability table (CPT):
each row contains the conditional
probability of each node value for a
conditioning case (a possible combination
of values for the parent nodes).
3/21/2016 8
Compactness of Bayesian networks
A CPT for Boolean Xi with k Boolean parents has 2^k rows for the
combinations of parent values. Each row requires one number p for
Xi =true (the number for Xi =false is just 1-p)
If each variable has no more than k parents, The complete network
requires O(n. 2^k) numbers i.e., grows linearly with n, vs. O(2^k) for
the full joint distribution
For Burglary net,
1+1+4+2+2=10 numbers
(vs. 2^5-1=31)
3/21/2016 503043 - PROBABILISTIC REASONING 9
Global semantics of Bayesian networks
Global semantics defines the full
joint distribution as the product of
the local conditional distributions
, X n ) i 1 p( X i | Parents( X i ))
n
p( X 1 ,
e. g.
p ( j m a b e)
p( j | a ) p(m | a) p( a | b, e) p(b) p(e)
0.90 0.70 0.001 0.999 0.998
3/21/2016
0.00062
Local semantics of Bayesian network
e.g., JohnCalls is independent of Burglary and Earthquake,
given the value of Alarm.
3/21/2016 11
Markov blanket
e.g., Burglary is independent of JohnCalls and MaryCalls ,
given the value of Alarm and Earthquake.
3/21/2016
Constructing Bayesian networks
Need a method such that a series of locally testable assertions of
conditional independence guarantees the required global semantics.
The correct order in which to add nodes is to add the “root causes”
first, then the variables they influence, and so on.
What happens if we choose the wrong order?
3/21/2016 13
Example
3/21/2016 14
Example
3/21/2016 15
Example
3/21/2016 16
Example
3/21/2016 17
Example
3/21/2016 18
Example
Deciding conditional independence is hard in noncausal directions.
Assessing conditional probabilities is hard in noncausal directions
Network is less compact: 1 + 2 + 4 + 2 + 4 = 13 numbers needed
3/21/2016 19
Example: Car diagnosis
Initial evidence: car won’t start
Testable variables (green), “broken, so fix it” variables (orange)
Hidden variables (gray) ensure sparse structure, reduce parameters
3/21/2016 20
Example: Car insurance
3/21/2016 21
Class Exercise
1. Using the axioms of probability, prove
2. Given Bayesian Network
p( P | P Q ) 1
◦ Calculate
◦ In what condition,
P p(P)
p( P Q ) Q p(Q|P), p(Q| ﹁ P)
p( P Q ) p(Q P )
3/21/2016
Efficient representation of conditional
distributions
CPT grows exponentially with number of parents O(2k)
CPT becomes infinite with continuous-valued parent or child
Solution: canonical distribution that can be specified by a few parameters
Simplest example: deterministic node whose value specified exactly by the values of its
parents, with no uncertainty
3/21/2016 503043 - PROBABILISTIC REASONING 23
Efficient representation of conditional
distributions
“Noisy” logic relationships: uncertain relationships
noisy-OR model allows for uncertainty about the ability of each parent to cause
the child to be true, but the causal relationship between parent and child maybe
inhibited.
E.g.: Fever is caused by Cold, Flu, or Malaria, but a patient could have a
cold, but not exhibit a fever.
Two assumptions of noisy-OR
parents include all the possible causes (can add leak node that covers
“miscellaneous causes.”)
inhibition of each parent is independent of inhibition of any other parents,
e.g., whatever inhibits Malaria from causing a fever is independent of whatever
inhibits Flu from causing a fever
Pfever | cold , flu, malaria 0.6
Pfever | cold , flu, malaria 0.2 Cold Flu Malaria
Pfever | cold , flu, malaria 0.1
Cold
3/21/2016
24
503043 - PROBABILISTIC REASONING
Efficient representation of conditional distributions
Other probabilities can be calculated from the product of the
inhibition probabilities for each parent
Number of parameters linear in number of parents
O(2k)O(k)
3/21/2016
25
503043 - PROBABILISTIC REASONING
Bayesian nets with continuous variables
Hybrid Bayesian network: discrete variables + continuous variables
Discrete (Subsidy? and Buys?); continuous (Harvest and Cost)
Two options
discretization – possibly large errors, large CPTs
finitely parameterized canonical families(E.g.: Gaussian Distribution )
Two kinds of conditional distributions for hybrid Bayesian
network
continuous variable given discrete or continuous parents (e.g., Cost)
discrete variable given continuous parents (e.g., Buys?)
3/21/2016
26
503043 - PROBABILISTIC REASONING
Continuous child variables
Need one conditional density function for child variable given
continuous parents, for each possible assignment to discrete parents
Most common is the linear Gaussian model, e.g.,:
Mean Cost varies linearly with Harvest, variance is fixed
the linear model is reasonable only if the harvest size is limited to a
narrow range
3/21/2016
27
503043 - PROBABILISTIC REASONING
Continuous child variables
Discrete + continuous linear Gaussian network is a conditional
Gaussian network, i.e., a multivariate Gaussian distribution over
all continuous variables for each combination of discrete variable
values.
A multivariate Gaussian distribution is a surface in more than one
dimension that has a peak at the mean and drops off on all sides
3/21/2016
28
503043 - PROBABILISTIC REASONING
Discrete variable with continuous parents
Probability of Buys?
given Cost should
be a “soft” threshold”
Probit distribution uses
integral of Gaussian:
3/21/2016 503043 - PROBABILISTIC REASONING 29
Discrete variable with continuous parents
Sigmoid (or logit) distribution also used in neural networks:
Sigmoid has similar shape to probit but much longer tails
3/21/2016
30
503043 - PROBABILISTIC REASONING
Exact inference by enumeration
A query can be answered using a Bayesian network by computing
sums of products of conditional probabilities from the network.
sum over hidden variables: earthquake and alarm
d = 2 when we have n Boolean variables
3/21/2016 503043 - PROBABILISTIC REASONING 31
Evaluation tree
3/21/2016 503043 - PROBABILISTIC REASONING 32
Exact inference by variable elimination
Do the calculation once and save the results for later use – idea of
dynamic programming
Variable elimination: carry out summations right-to-left, storing
intermediate results (factors) to avoid re-computation
3/21/2016 503043 - PROBABILISTIC REASONING 33
Variable elimination – basic operations
3/21/2016 503043 - PROBABILISTIC REASONING 34
Variable elimination – irrelevant variables
The complexity of variable elimination
Single connected networks (or polytrees)
any two nodes are connected by at most one (undirected) path
time and space cost of variable elimination are O(d k n) , d = 2 (n Boolean variables)
i.e., linear in the number of variables (nodes) if the number of parents of each node is
bounded by a constant
Multiply connected network
variable elimination can have exponential time and space complexity even the number
of parents per node is bounded.
3/21/2016 503043 - PROBABILISTIC REASONING 35
Approximate inference by stochastic
simulation*
Direct sampling
Generate events from (an empty) network that has no associated evidence
Rejection sampling: reject samples disagreeing with evidence
Likelihood weighting: use evidence to weight samples
Markov chain Monte Carlo (MCMC)*
sample from a stochastic process whose stationary distribution
is the true posterior
3/21/2016
36
503043 - PROBABILISTIC REASONING
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 37
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 38
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 39
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 40
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 41
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 42
Example of sampling from an empty network
3/21/2016 503043 - PROBABILISTIC REASONING 43
Example of sampling from an empty network
3/21/2016
44
503043 - PROBABILISTIC REASONING
Rejection sampling
3/21/2016
45
503043 - PROBABILISTIC REASONING
Likelihood weighting
3/21/2016
46
503043 - PROBABILISTIC REASONING
Likelihood weighting
3/21/2016 503043 - PROBABILISTIC REASONING 47
Likelihood weighting
3/21/2016
48
503043 - PROBABILISTIC REASONING
Likelihood weighting
3/21/2016 503043 - PROBABILISTIC REASONING 49
Likelihood weighting
3/21/2016
50
503043 - PROBABILISTIC REASONING
Likelihood weighting
3/21/2016
51
503043 - PROBABILISTIC REASONING
Likelihood weighting
3/21/2016 503043 - PROBABILISTIC REASONING 52
Likelihood weighting analysis
3/21/2016
53
503043 - PROBABILISTIC REASONING
Approximate inference using MCMC*
3/21/2016
54
503043 - PROBABILISTIC REASONING
The Markov chain
3/21/2016
55
503043 - PROBABILISTIC REASONING
MCMC example
3/21/2016
56
503043 - PROBABILISTIC REASONING
Markov blanket sampling
3/21/2016
57
503043 - PROBABILISTIC REASONING
3/21/2016 503043 - PROBABILISTIC REASONING 58