Introduction to Artificial Intelligence Inference in Bayesian - - PowerPoint PPT Presentation
Introduction to Artificial Intelligence Inference in Bayesian - - PowerPoint PPT Presentation
Introduction to Artificial Intelligence Inference in Bayesian networks Janyl Jumadinova September 28-30, 2016 Inference tasks Simple queries : compute posterior probabilities Optimal decisions : decision networks include utility
Inference tasks
◮ Simple queries: compute posterior probabilities ◮ Optimal decisions: decision networks include utility
information; probabilistic inference required for P(outcome|action, evidence)
◮ Value of information: which evidence to seek next? ◮ Sensitivity analysis: which probability values are most critical? 2/19
Bayesian Networks
◮
T: The lecture started by 10 : 35
◮
L: The lecturer arrives late
◮
R: The lecture concerns robots
◮
M: The lecturer is Masha
◮
S: It is sunny
3/19
Bayesian Networks
Let’s say we want to find: P(R|T, S)?
4/19
Bayesian Networks
Let’s say we want to find: P(R|T, S)?
4/19
Bayesian Networks
Let’s say we want to find: P(RT, S)?
5/19
Joint Probability: General Case
6/19
Conditional probabilities by enumerating all matching entries in the joint are expensive:
Exponential in the number of variables
7/19
Winter? (A) Sprinkler? (B) WetGrass? (D) Rain? (C) SlipperyRoad? (E) A ΘA true .6 false .4 A B ΘB|A true true .2 true false .8 false true .75 false false .25 A C ΘC|A true true .8 true false .2 false true .1 false false .9 B C D ΘD|B,C true true true .95 true true false .05 true false true .9 true false false .1 false true true .8 false true false .2 false false true false false false 1 C E ΘE|C true true .7 true false .3 false true false false 1
8/19
Variable Elimination
Pr(D, E) ?
9/19
Variable Elimination
Pr(D, E) ?
◮ We can sum out variables without having to construct the joint
probability distribution explicitly.
◮ Variables can be summed out while keeping the original
distribution, and all successive distributions, in factored form ( θ
- prior probability)
P(d, e) =
- a,b,c
θe|cθd|bcθc|aθb|aθa
9/19
Variable Elimination
Pr(D, E) ?
◮ We can sum out variables without having to construct the joint
probability distribution explicitly.
◮ Variables can be summed out while keeping the original
distribution, and all successive distributions, in factored form ( θ
- prior probability)
P(d, e) =
- a,b,c
θe|cθd|bcθc|aθb|aθa
◮ This allows the procedure to sometimes escape the exponential
complexity of the brute-force method.
9/19
Variable elimination: carry out summations right-to-left, storing intermediate results (factors) to avoid recomputation Factors are matrices indexed by the values of its argument variables
10/19
Variable Elimination
Summing out a variable from a product of factors f :
- move any constant factors outside the summation
- add up submatrices in pointwise product of remaining factors
- x f1 × · · · × fk = f1 × · · · × fi
- x fi+1 × · · · × fk = f1 × · · · × fi × f ¯
X
assuming f1, . . . , fi do not depend on X Pointwise product of factors f1 and f2: f1(x1, . . . , xj, y1, . . . , yk) × f2(y1, . . . , yk, z1, . . . , zl) = f (x1, . . . , xj, y1, . . . , yk, z1, . . . , zl) E.g., f1(a, b) × f2(b, c) = f (a, b, c)
11/19
12/19
Review:
Bayesian Inference
Bayesian inference is about the quantification and propagation of uncertainty, defined via a probability, in light of observations of the system. From Prior → Posterior
13/19
Review:
Bayesian Inference
Bayesian inference is about the quantification and propagation of uncertainty, defined via a probability, in light of observations of the system. From Prior → Posterior
Reminder: A posterior probability is the probability of the event’s outcome given the data (observation). A prior probability is the probability of the event’s outcome before you collect the data (make observations).
13/19
Bayesian Inference: determining posterior distributions in belief networks
◮ Exact inference by enumeration ◮ Exact inference by variable elimination ◮ Approximate inference by stochastic simulation 14/19
Bayesian Inference
◮ Exact inference by variable elimination:
- Exploit the structure of the network to eliminate (sum out)
the non-observed, non-query variables one at a time
15/19
Bayesian Inference
◮ Exact inference by variable elimination:
- Exploit the structure of the network to eliminate (sum out)
the non-observed, non-query variables one at a time
- Finding an elimination ordering that results in the smallest
tree-width is NP-hard
15/19
Bayesian Inference
◮ Exact inference by variable elimination:
- Exploit the structure of the network to eliminate (sum out)
the non-observed, non-query variables one at a time
- Finding an elimination ordering that results in the smallest
tree-width is NP-hard
◮ Approximate inference by stochastic simulation 15/19
Inference by stochastic simulation
Basic Idea:
- 1. Draw N samples from a sampling distribution
- 2. Compute an approximate posterior probability
- 3. Show this converges to the true probability
16/19
17/19
Inference by stochastic simulation
◮ Rejection sampling: reject samples disagreeing with evidence 18/19
Inference by stochastic simulation
◮ Rejection sampling: reject samples disagreeing with evidence ◮ Likelihood weighting: use evidence to weight samples 18/19
Inference by stochastic simulation
◮ 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
18/19
Bayesian Inference
Class Exercise
- 1. Find Netlogo models titled Bayes1D, Drift, Spatial and
Monte Carlo Pi in the “cs370f2016-share/in-class/sep30 BaysianNetlogoModels” directory, and explore them in this order.
- 2. For the first three models, (in the Google form) in your own
words give a 1-2 sentence description of the model and comment on how it uses Bayesian inference.
- 3. For the last model (Monte Carlo), complete the documentation
inside the Netlogo’s “Info” tab and submit the updated model to your own repository.
19/19