Bayesian networks (2) Lirong Xia.

Slides:



Advertisements
Similar presentations
Introduction to Graphical Models Brookes Vision Lab Reading Group.
Advertisements

Bayesian networks Chapter 14 Section 1 – 2. Outline Syntax Semantics Exact computation.
Probabilistic models Jouni Tuomisto THL. Outline Deterministic models with probabilistic parameters Hierarchical Bayesian models Bayesian belief nets.
Bayesian Networks CSE 473. © Daniel S. Weld 2 Last Time Basic notions Atomic events Probabilities Joint distribution Inference by enumeration Independence.
Lirong Xia Bayesian networks (2) Thursday, Feb 25, 2014.
BAYESIAN NETWORKS. Bayesian Network Motivation  We want a representation and reasoning system that is based on conditional independence  Compact yet.
Identifying Conditional Independencies in Bayes Nets Lecture 4.
Toothache  toothache catch  catch catch  catch cavity  cavity Joint PDF.
CS 188: Artificial Intelligence Fall 2009 Lecture 15: Bayes’ Nets II – Independence 10/15/2009 Dan Klein – UC Berkeley.
CS 188: Artificial Intelligence Spring 2009 Lecture 15: Bayes’ Nets II -- Independence 3/10/2009 John DeNero – UC Berkeley Slides adapted from Dan Klein.
CS 188: Artificial Intelligence Spring 2007 Lecture 14: Bayes Nets III 3/1/2007 Srini Narayanan – ICSI and UC Berkeley.
CS 188: Artificial Intelligence Fall 2006 Lecture 17: Bayes Nets III 10/26/2006 Dan Klein – UC Berkeley.
Bayesian Networks Alan Ritter.
1 Bayesian Networks Chapter ; 14.4 CS 63 Adapted from slides by Tim Finin and Marie desJardins. Some material borrowed from Lise Getoor.
Advanced Artificial Intelligence
CPS 270: Artificial Intelligence Bayesian networks Instructor: Vincent Conitzer.
Machine Learning CUNY Graduate Center Lecture 21: Graphical Models.
Bayes’ Nets  A Bayes’ net is an efficient encoding of a probabilistic model of a domain  Questions we can ask:  Inference: given a fixed BN, what is.
Made by: Maor Levy, Temple University  Probability expresses uncertainty.  Pervasive in all of Artificial Intelligence  Machine learning 
Bayesian networks Chapter 14. Outline Syntax Semantics.
CSE 473: Artificial Intelligence Spring 2012 Bayesian Networks Dan Weld Many slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer.
Bayesian networks. Motivation We saw that the full joint probability can be used to answer any question about the domain, but can become intractable as.
QUIZ!!  T/F: Traffic, Umbrella are cond. independent given raining. TRUE  T/F: Fire, Smoke are cond. Independent given alarm. FALSE  T/F: BNs encode.
Announcements Project 4: Ghostbusters Homework 7
PATTERN RECOGNITION AND MACHINE LEARNING CHAPTER 8: GRAPHICAL MODELS.
Bayesian Network By Zhang Liliang. Key Point Today Intro to Bayesian Network Usage of Bayesian Network Reasoning BN: D-separation.
Probabilistic Reasoning [Ch. 14] Bayes Networks – Part 1 ◦Syntax ◦Semantics ◦Parameterized distributions Inference – Part2 ◦Exact inference by enumeration.
1 CMSC 671 Fall 2001 Class #20 – Thursday, November 8.
Computer vision: models, learning and inference Chapter 2 Introduction to probability.
CS 541: Artificial Intelligence Lecture VII: Inference in Bayesian Networks.
Artificial Intelligence Bayes’ Nets: Independence Instructors: David Suter and Qince Li Course Harbin Institute of Technology [Many slides.
CS 188: Artificial Intelligence Spring 2007
CS 2750: Machine Learning Directed Graphical Models
Utilities and Decision Theory
Reasoning Under Uncertainty: More on BNets structure and construction
Bayesian networks Chapter 14 Section 1 – 2.
Presented By S.Yamuna AP/CSE
Qian Liu CSE spring University of Pennsylvania
Inference in Bayesian Networks
Bayesian networks (1) Lirong Xia Spring Bayesian networks (1) Lirong Xia Spring 2017.
Reasoning Under Uncertainty: More on BNets structure and construction
Probabilistic Models Models describe how (a portion of) the world works Models are always simplifications May not account for every variable May not account.
CS 4/527: Artificial Intelligence
Quizzz Rihanna’s car engine does not start (E).
Probability Topics Random Variables Joint and Marginal Distributions
Structure and Semantics of BN
Inference Inference: calculating some useful quantity from a joint probability distribution Examples: Posterior probability: Most likely explanation: B.
CS 188: Artificial Intelligence
Instructors: Fei Fang (This Lecture) and Dave Touretzky
CAP 5636 – Advanced Artificial Intelligence
CSE 473: Artificial Intelligence Autumn 2011
CS 188: Artificial Intelligence
CS 188: Artificial Intelligence Fall 2007
CS 188: Artificial Intelligence Fall 2008
Class #19 – Tuesday, November 3
CS 188: Artificial Intelligence
CS 188: Artificial Intelligence Fall 2008
Class #16 – Tuesday, October 26
CS 188: Artificial Intelligence Spring 2007
Structure and Semantics of BN
CPS 570: Artificial Intelligence Bayesian networks
Instructor: Vincent Conitzer
Bayesian networks Chapter 14 Section 1 – 2.
CS 188: Artificial Intelligence Spring 2006
Utilities and Decision Theory
Utilities and Decision Theory
Probabilistic Reasoning
Bayesian networks (2) Lirong Xia. Bayesian networks (2) Lirong Xia.
Bayesian networks (1) Lirong Xia. Bayesian networks (1) Lirong Xia.
CS 188: Artificial Intelligence Fall 2008
Presentation transcript:

Bayesian networks (2) Lirong Xia

Last class Bayesian networks compact, graphical representation of a joint probability distribution conditional independence

Bayesian network Definition of Bayesian network (Bayes’ net or BN) A set of nodes, one per variable X A directed, acyclic graph A conditional distribution for each node A collection of distributions over X, one for each combination of parents’ values p(X|a1,…, an) CPT: conditional probability table Description of a noisy “causal” process A Bayesian network = Topology (graph) + Local Conditional Probabilities

Probabilities in BNs Bayesian networks implicitly encode joint distributions As a product of local conditional distributions Example: This lets us reconstruct any entry of the full joint Not every BN can represent every joint distribution The topology enforces certain conditional independencies

Reachability (D-Separation) Question: are X and Y conditionally independent given evidence vars {Z}? Yes, if X and Y “separated” by Z Look for active paths from X to Y No active paths = independence! A path is active if each triple is active: Causal chain where B is unobserved (either direction) Common cause where B is unobserved Common effect where B or one of its descendents is observed All it takes to block a path is a single inactive segment

Checking conditional independence from BN graph Given random variables Z1,…Zp, we are asked whether X⊥Y|Z1,…Zp Step 1: shade Z1,…Zp Step 2: for each undirected path from X to Y if all triples are active, then X and Y are NOT conditionally independent If all paths have been checked and none of them is active, then X⊥Y|Z1,…Zp

Example Yes!

Example Yes! Yes! Yes!

Example Variables: Questions: Yes! R: Raining T: Traffic D: Roof drips S: I am sad Questions: Yes!

Today: Inference---variable elimination (dynamic programming)

Inference Inference: calculating some useful quantity from a joint probability distribution Examples: Posterior probability: Most likely explanation:

Inference Given unlimited time, inference in BNs is easy Recipe: State the marginal probabilities you need Figure out ALL the atomic probabilities you need Calculate and combine them Example:

Example: Enumeration In this simple method, we only need the BN to synthesize the joint entries

Inference by Enumeration?

More elaborate rain and sprinklers example Sprinklers were on p(+R) = .2 Rained p(+S) = .6 Neighbor walked dog p(+G|+R,+S) = .9 p(+G|+R,-S) = .7 p(+G|-R,+S) = .8 p(+G|-R,-S) = .2 Grass wet p(+N|+R) = .3 p(+N|-R) = .4 p(+D|+N,+G) = .9 p(+D|+N,-G) = .4 p(+D|-N,+G) = .5 p(+D|-N,-G) = .3 Dog wet

Inference Want to know: p(+R|+D) = p(+R,+D)/P(+D) Sprinklers were on p(+R) = .2 Rained p(+S) = .6 Neighbor walked dog p(+G|+R,+S) = .9 p(+G|+R,-S) = .7 p(+G|-R,+S) = .8 p(+G|-R,-S) = .2 Grass wet p(+N|+R) = .3 p(+N|-R) = .4 p(+D|+N,+G) = .9 p(+D|+N,-G) = .4 p(+D|-N,+G) = .5 p(+D|-N,-G) = .3 Dog wet Want to know: p(+R|+D) = p(+R,+D)/P(+D) Let’s compute p(+R,+D)

Inference Sprinklers were on Rained Neighbor walked dog Grass wet p(+S) = .6 Neighbor walked dog p(+G|+R,+S) = .9 p(+G|+R,-S) = .7 p(+G|-R,+S) = .8 p(+G|-R,-S) = .2 Grass wet p(+N|+R) = .3 p(+N|-R) = .4 p(+D|+N,+G) = .9 p(+D|+N,-G) = .4 p(+D|-N,+G) = .5 p(+D|-N,-G) = .3 Dog wet p(+R,+D)= ΣsΣgΣn p(+R)p(s)p(n|+R)p(g|+R,s)p(+D|n,g) = p(+R)Σsp(s)Σgp(g|+R,s)Σn p(n|+R)p(+D|n,g)

The formula p(+R,+D)= p(+R)Σsp(s) Σgp(g|+R,s) Σn p(n|+R)p(+D|n,g) Order: s>g>n is what we want to compute only involves s only involves s, g f2(s,g) f1(s)

Variable elimination Sprinklers were on Rained Neighbor walked dog p(+S) = .6 Neighbor walked dog p(+G|+R,+S) = .9 p(+G|+R,-S) = .7 p(+G|-R,+S) = .8 p(+G|-R,-S) = .2 Grass wet p(+N|+R) = .3 p(+N|-R) = .4 p(+D|+N,+G) = .9 p(+D|+N,-G) = .4 p(+D|-N,+G) = .5 p(+D|-N,-G) = .3 Dog wet From the factor Σn p(n|+R)p(+D|n,g) we sum out n to obtain a factor only depending on g f2(s, g) happens to be insensitive to s, lucky! f2(s,+G) = [Σn p(n|+R)p(+D|n,+G)] = p(+N|+R)P(+D|+N,+G) + p(-N|+R)p(+D|-N,+G) = .3*.9+.7*.5 = .62 f2(s,-G) = [Σn p(n|+R)p(+D|n,-G)] = p(+N|+R)p(+D|+N,-G) + p(-N|+R)p(+D|-N,-G) = .3*.4+.7*.3 = .33

Calculating f1(s) f1(s) = p(+G|+R,s) f2(s,+G) + p(-G|+R,s) f2(s,-G)

Calculating p(+R,+D) p(+R,+D)= p(+R)p(+S) f1(+S) + p(+R)p(- S) f1(-S) =0.2*(0.6*0.591+0.4*0.533)=0.11356

Elimination order matters Sprinklers were on p(+R) = .2 Rained p(+S) = .6 Neighbor walked dog p(+G|+R,+S) = .9 p(+G|+R,-S) = .7 p(+G|-R,+S) = .8 p(+G|-R,-S) = .2 Grass wet p(+N|+R) = .3 p(+N|-R) = .4 p(+D|+N,+G) = .9 p(+D|+N,-G) = .4 p(+D|-N,+G) = .5 p(+D|-N,-G) = .3 Dog wet p(+R,+D)= ΣnΣsΣg p(+r)p(s)p(n|+R)p(g|+r,s)p(+D|n,g) = p(+R)Σnp(n|+R)Σsp(s)Σg p(g|+R,s)p(+D|n,g) Last factor will depend on two variables in this case!

General method for variable elimination Compute a marginal probability p(x1,…,xp) in a Bayesian network Let Y1,…,Yk denote the remaining variables Step 1: fix an order over the Y’s (wlog Y1>…>Yk) Step 2: rewrite the summation as Σy1 Σy2 …Σyk-1 Σykanything Step 3: variable elimination from right to left sth only involving X’s sth only involving Y1 and X’s sth only involving Y1, Y2,…,Yk-1 and X’s sth only involving Y1, Y2 and X’s