Quizzz Rihanna’s car engine does not start (E).

Slides:



Advertisements
Similar presentations
Lirong Xia Bayesian networks (2) Thursday, Feb 25, 2014.
Advertisements

Inference in Bayesian Nets
CS 188: Artificial Intelligence Fall 2009 Lecture 16: Bayes’ Nets III – Inference 10/20/2009 Dan Klein – UC Berkeley.
5/25/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 16, 6/1/2005 University of Washington, Department of Electrical Engineering Spring 2005.
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.
Announcements Homework 8 is out Final Contest (Optional)
CS 188: Artificial Intelligence Fall 2009 Lecture 19: Hidden Markov Models 11/3/2009 Dan Klein – UC Berkeley.
CS 188: Artificial Intelligence Fall 2009 Lecture 14: Bayes’ Nets 10/13/2009 Dan Klein – UC Berkeley.
1 Bayesian Networks Chapter ; 14.4 CS 63 Adapted from slides by Tim Finin and Marie desJardins. Some material borrowed from Lise Getoor.
Announcements  Midterm 1  Graded midterms available on pandagrader  See Piazza for post on how fire alarm is handled  Project 4: Ghostbusters  Due.
Artificial Intelligence CS 165A Tuesday, November 27, 2007  Probabilistic Reasoning (Ch 14)
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.
QUIZ!!  T/F: The forward algorithm is really variable elimination, over time. TRUE  T/F: Particle Filtering is really sampling, over time. TRUE  T/F:
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.
An Introduction to Artificial Intelligence Chapter 13 & : Uncertainty & Bayesian Networks Ramin Halavati
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  Office hours this week Tuesday (as usual) and Wednesday  HW6 posted, due Monday 10/20.
Bayes’ Nets: Sampling [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available.
Announcements Project 4: Ghostbusters Homework 7
Marginalization & Conditioning Marginalization (summing out): for any sets of variables Y and Z: Conditioning(variant of marginalization):
CHAPTER 5 Probability Theory (continued) Introduction to Bayesian Networks.
QUIZ!!  In HMMs...  T/F:... the emissions are hidden. FALSE  T/F:... observations are independent given no evidence. FALSE  T/F:... each variable X.
Advanced Artificial Intelligence Lecture 5: Probabilistic Inference.
Inference Algorithms for Bayes Networks
CPSC 7373: Artificial Intelligence Lecture 5: Probabilistic Inference Jiang Bian, Fall 2012 University of Arkansas at Little Rock.
CSE 473: Artificial Intelligence Autumn 2011 Bayesian Networks: Inference Luke Zettlemoyer Many slides over the course adapted from either Dan Klein, Stuart.
Today Graphical Models Representing conditional dependence graphically
QUIZ!!  T/F: You can always (theoretically) do BNs inference by enumeration. TRUE  T/F: In VE, always first marginalize, then join. FALSE  T/F: VE is.
Artificial Intelligence Bayes’ Nets: Independence Instructors: David Suter and Qince Li Course Harbin Institute of Technology [Many slides.
CS 188: Artificial Intelligence Spring 2007
Qian Liu CSE spring University of Pennsylvania
Inference in Bayesian Networks
Bayesian networks (1) Lirong Xia Spring Bayesian networks (1) Lirong Xia Spring 2017.
Probabilistic Reasoning
Our Status We’re done with Part I (for now at least) Search and Planning! Reference AI winter --- logic (exceptions, etc. + so much knowledge --- can.
Artificial Intelligence
CS 4/527: Artificial Intelligence
CS 4/527: Artificial Intelligence
CS 4/527: Artificial Intelligence
CAP 5636 – Advanced Artificial Intelligence
Probabilistic Reasoning
CS 188: Artificial Intelligence Spring 2007
Probability Topics Random Variables Joint and Marginal Distributions
Advanced Artificial Intelligence
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
CS 188: Artificial Intelligence Fall 2008
CAP 5636 – Advanced Artificial Intelligence
CS 188: Artificial Intelligence Fall 2007
CSE 473: Artificial Intelligence Autumn 2011
CS 188: Artificial Intelligence
Probabilistic Reasoning
CS 188: Artificial Intelligence Fall 2007
CS 188: Artificial Intelligence Fall 2008
Probabilistic Reasoning
CAP 5636 – Advanced Artificial Intelligence
CS 188: Artificial Intelligence
CS 188: Artificial Intelligence Fall 2008
Announcements Midterm: Wednesday 7pm-9pm
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2007
CS 188: Artificial Intelligence Spring 2006
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
Bayesian Networks: Structure and Semantics
Bayesian networks (2) Lirong Xia.
Presentation transcript:

Quizzz Rihanna’s car engine does not start (E). The battery could be dead (B), or the gas tank could be empty (G). If the battery is empty, that might also cause the lamp to not work (L). The reason why the battery could be empty is a broken alternator (A) or just a very old battery (O). Which minimal graphical model, best describes this situation? In which models is E cond. ind. of O, given B? In which models is G cond. ind. of B, given L? In model I is O cond. ind. of G, given B and E? ANSWER: II is the minimal Bayes Net that describes this situation. III could also be used (but wouyld be inefficient. IV, I do not have dependencies that are stated in the problem.

CSE 511a: Artificial Intelligence Spring 2013 Lecture 16: Bayes’ Nets III – Inference 03/27/2013 Robert Pless via Kilian Q. Weinberger Several slides adapted from Dan Klein – UC Berkeley

Announcements Project 3 due, midnight, Monday. No late days can be used for bonus points.

Inference Inference: calculating some useful quantity from a joint probability distribution Examples: Posterior probability: Most likely explanation: B E A J M

Inference by Enumeration 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: B E A J M Given that john and mary called, what is the probability that there was a burglary?

Example: Enumeration In this simple method, we only need the BN to synthesize the joint entries This has 4 terms because there are two binary variables that we are marginalizing over… we need all combinations of +e, e, and +a, -a

Inference by Enumeration?

Variable Elimination Why is inference by enumeration on a Bayes Net inefficient? You join up the whole joint distribution before you sum out the hidden variables You end up repeating a lot of work! Idea: interleave joining and marginalizing! Called “Variable Elimination” Choosing the order to eliminate variables that minimizes work is NP-hard, but *anything* sensible is much faster than inference by enumeration We’ll need some new notation to define VE IDEA: Once you have a Bayes NET, and some set of observed variables, and a QUERY node, we can progressively SIMPLIFY the bayes net. The simplifications are marginalizing and joining.

5-minute quiz

Factor Zoo I Joint distribution: P(X,Y) Selected joint: P(x,Y) Entries P(x,y) for all x, y Sums to 1 Selected joint: P(x,Y) A slice of the joint distribution Entries P(x,y) for fixed x, all y Sums to P(x) T W P hot sun 0.4 rain 0.1 cold 0.2 0.3 Bottom: Sums to P(x). That how we would compute P(x) if we needed to! T W P cold sun 0.2 rain 0.3

Factor Zoo II Family of conditionals: P(X |Y) Multiple conditionals Entries P(x | y) for all x, y Sums to |Y| Single conditional: P(X | y) Entries P(x | y) for fixed y, all x Sums to 1 T W P hot sun 0.8 rain 0.2 cold 0.4 0.6 Sums to Y because we need P( X | y1), P(X | y2), … T W P cold sun 0.4 rain 0.6

Factor Zoo III In general, when we write P(Y1 … YN | X1 … XM) Specified family: P(y | X) Entries P(y | x) for fixed y, but for all x Sums to … who knows! In general, when we write P(Y1 … YN | X1 … XM) It is a “factor,” a multi-dimensional array Its values are all P(y1 … yN | x1 … xM) Any assigned X or Y is a dimension missing (selected) from the array T W P hot rain 0.2 cold 0.6

Example: Traffic Domain Random Variables R: Raining T: Traffic L: Late for class! First query: P(L) R +r 0.1 -r 0.9 T +r +t 0.8 -t 0.2 -r 0.1 0.9 L What would it take to solve for P(L) by enumeration? Build all 2^3 rows of the joint table. Sum all examples of P(+L) and P(-L). +t +l 0.3 -l 0.7 -t 0.1 0.9

Variable Elimination Outline Track objects called factors Initial factors are local CPTs (one per node) Any known values are selected E.g. if we know , the initial factors are VE: Alternately join factors and eliminate variables +r 0.1 -r 0.9 +r +t 0.8 -t 0.2 -r 0.1 0.9 +t +l 0.3 -l 0.7 -t 0.1 0.9 +r 0.1 -r 0.9 +r +t 0.8 -t 0.2 -r 0.1 0.9 +t +l 0.3 -t 0.1

Operation 1: Join Factors First basic operation: joining factors Combining factors: Just like a database join Get all factors over the joining variable Build a new factor over the union of the variables involved Example: Join on R Computation for each entry: pointwise products R +r 0.1 -r 0.9 +r +t 0.8 -t 0.2 -r 0.1 0.9 +r +t 0.08 -t 0.02 -r 0.09 0.81 Merging merges your tables and your childrens tables. R,T T

Example: Multiple Joins +r 0.1 -r 0.9 R Join R R, T +r +t 0.08 -t 0.02 -r 0.09 0.81 T +r +t 0.8 -t 0.2 -r 0.1 0.9 L L +t +l 0.3 -l 0.7 -t 0.1 0.9 +t +l 0.3 -l 0.7 -t 0.1 0.9

Example: Multiple Joins R, T, L +r +t 0.08 -t 0.02 -r 0.09 0.81 R, T Join T +r +t +l 0.024 -l 0.056 -t 0.002 0.018 -r 0.027 0.063 0.081 0.729 L +t +l 0.3 -l 0.7 -t 0.1 0.9

Operation 2: Eliminate Second basic operation: marginalization Take a factor and sum out a variable Shrinks a factor to a smaller one A projection operation Example: +r +t 0.08 -t 0.02 -r 0.09 0.81 +t 0.17 -t 0.83

Multiple Elimination Sum Sum out T out R R, T, L T, L L 0.024 0.056 0.002 0.018 -r 0.027 0.063 0.081 0.729 +t +l 0.051 -l 0.119 -t 0.083 0.747 +l 0.134 -l 0.886

P(L) : Marginalizing Early! 0.1 -r 0.9 Sum out R Join R R +r +t 0.08 -t 0.02 -r 0.09 0.81 +t 0.17 -t 0.83 +r +t 0.8 -t 0.2 -r 0.1 0.9 T T R, T L L +t +l 0.3 -l 0.7 -t 0.1 0.9 +t +l 0.3 -l 0.7 -t 0.1 0.9 +t +l 0.3 -l 0.7 -t 0.1 0.9 L

Marginalizing Early (aka VE*) T T, L L Join T Sum out T L +t 0.17 -t 0.83 +t +l 0.051 -l 0.119 -t 0.083 0.747 +l 0.134 -l 0.886 +t +l 0.3 -l 0.7 -t 0.1 0.9 * VE is variable elimination

Evidence If evidence, start with factors that select that evidence If there is no evidence, then use these initial factors: Computing , the initial factors become: We eliminate all vars other than query + evidence +r 0.1 -r 0.9 +r +t 0.8 -t 0.2 -r 0.1 0.9 +t +l 0.3 -l 0.7 -t 0.1 0.9 +r 0.1 +r +t 0.8 -t 0.2 +t +l 0.3 -l 0.7 -t 0.1 0.9

Evidence II Result will be a selected joint of query and evidence E.g. for P(L | +r), we’d end up with: To get our answer, just normalize this! That’s it! Normalize +r +l 0.026 -l 0.074 +l 0.26 -l 0.74

General Variable Elimination Query: Start with initial factors: Local CPTs (but instantiated by evidence) While there are still hidden variables (not Q or evidence): Pick a hidden variable H Join all factors mentioning H Eliminate (sum out) H Join all remaining factors and normalize

Variable Elimination Bayes Rule Start / Select Join on B Normalize B a, B B P +b 0.1 b 0.9 a A B P +a +b 0.08 b 0.09 A B P +a +b 8/17 b 9/17 B A P +b +a 0.8 b a 0.2 b 0.1 0.9

Example j,m B E A,j,m B E Choose A Do THIS ON THE BOARD. WRITE AS BIG SUMMATION

Example B B Choose E j,m j,m,E Finish with B j,m,B Normalize Doesn’t this seem like the worst order ever? Better would be to choose B, E first, then you never have a factor with 5 variables? Finish with B j,m,B Normalize

Variable Elimination What you need to know: Should be able to run it on small examples, understand the factor creation / reduction flow Better than enumeration: saves time by marginalizing variables as soon as possible rather than at the end Order of variables matters, optimal order is NP hard to find. We will see special cases of VE later On tree-structured graphs, variable elimination runs in polynomial time, like tree-structured CSPs You’ll have to implement a tree-structured special case to track invisible ghosts (Project 4)

http://www.cs.cmu.edu/~javabayes/Home/applet.html