Reasoning Under Uncertainty: Independence and Inference Jim Little Uncertainty 5 Nov 10, 2014 Textbook §6.3.1, 6.5, 6.5.1, 6.5.2.

Slides:



Advertisements
Similar presentations
Reasoning under Uncertainty: Marginalization, Conditional Prob., and Bayes Computer Science cpsc322, Lecture 25 (Textbook Chpt ) Nov, 6, 2013.
Advertisements

Belief networks Conditional independence Syntax and semantics Exact inference Approximate inference CS 460, Belief Networks1 Mundhenk and Itti Based.
Reasoning Under Uncertainty: Bayesian networks intro Jim Little Uncertainty 4 November 7, 2014 Textbook §6.3, 6.3.1, 6.5, 6.5.1,
Lirong Xia Approximate inference: Particle filter Tue, April 1, 2014.
Slide 1 Reasoning Under Uncertainty: More on BNets structure and construction Jim Little Nov (Textbook 6.3)
Decision Making Under Uncertainty Jim Little Decision 1 Nov
Advanced Artificial Intelligence
CPSC 322, Lecture 26Slide 1 Reasoning Under Uncertainty: Belief Networks Computer Science cpsc322, Lecture 27 (Textbook Chpt 6.3) March, 16, 2009.
Reasoning under Uncertainty: Conditional Prob., Bayes and Independence Computer Science cpsc322, Lecture 25 (Textbook Chpt ) March, 17, 2010.
CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 2009.
CPSC 322, Lecture 28Slide 1 Reasoning Under Uncertainty: More on BNets structure and construction Computer Science cpsc322, Lecture 28 (Textbook Chpt 6.3)
CPSC 322, Lecture 21Slide 1 Bottom Up: Soundness and Completeness Computer Science cpsc322, Lecture 21 (Textbook Chpt 5.2) March, 5, 2010.
CPSC 322, Lecture 31Slide 1 Probability and Time: Markov Models Computer Science cpsc322, Lecture 31 (Textbook Chpt 6.5) March, 25, 2009.
CS 188: Artificial Intelligence Spring 2007 Lecture 14: Bayes Nets III 3/1/2007 Srini Narayanan – ICSI and UC Berkeley.
CPSC 322, Lecture 32Slide 1 Probability and Time: Hidden Markov Models (HMMs) Computer Science cpsc322, Lecture 32 (Textbook Chpt 6.5) March, 27, 2009.
CPSC 422, Lecture 18Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 18 Feb, 25, 2015 Slide Sources Raymond J. Mooney University of.
CPSC 422, Lecture 14Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 14 Feb, 4, 2015 Slide credit: some slides adapted from Stuart.
CPSC 322, Lecture 29Slide 1 Reasoning Under Uncertainty: Bnet Inference (Variable elimination) Computer Science cpsc322, Lecture 29 (Textbook Chpt 6.4)
CS 188: Artificial Intelligence Fall 2009 Lecture 19: Hidden Markov Models 11/3/2009 Dan Klein – UC Berkeley.
CPSC 322, Lecture 24Slide 1 Reasoning under Uncertainty: Intro to Probability Computer Science cpsc322, Lecture 24 (Textbook Chpt 6.1, 6.1.1) March, 15,
CS Bayesian Learning1 Bayesian Learning. CS Bayesian Learning2 States, causes, hypotheses. Observations, effect, data. We need to reconcile.
Quiz 4: Mean: 7.0/8.0 (= 88%) Median: 7.5/8.0 (= 94%)
CPSC 322, Lecture 24Slide 1 Finish Logics… Reasoning under Uncertainty: Intro to Probability Computer Science cpsc322, Lecture 24 (Textbook Chpt 6.1, 6.1.1)
Decision Theory: Optimal Policies for Sequential Decisions CPSC 322 – Decision Theory 3 Textbook §9.3 April 4, 2011.
Read R&N Ch Next lecture: Read R&N
Reasoning Under Uncertainty: Bayesian networks intro CPSC 322 – Uncertainty 4 Textbook §6.3 – March 23, 2011.
Department of Computer Science Undergraduate Events More
Probabilistic Reasoning ECE457 Applied Artificial Intelligence Spring 2007 Lecture #9.
CPSC 322, Lecture 32Slide 1 Probability and Time: Hidden Markov Models (HMMs) Computer Science cpsc322, Lecture 32 (Textbook Chpt 6.5.2) Nov, 25, 2013.
UIUC CS 498: Section EA Lecture #21 Reasoning in Artificial Intelligence Professor: Eyal Amir Fall Semester 2011 (Some slides from Kevin Murphy (UBC))
Reasoning Under Uncertainty: Conditioning, Bayes Rule & the Chain Rule Jim Little Uncertainty 2 Nov 3, 2014 Textbook §6.1.3.
Made by: Maor Levy, Temple University  Inference in Bayes Nets ◦ What is the probability of getting a strong letter? ◦ We want to compute the.
CPSC 322, Lecture 28Slide 1 More on Construction and Compactness: Compact Conditional Distributions Once we have established the topology of a Bnet, we.
Uncertainty. Assumptions Inherent in Deductive Logic-based Systems All the assertions we wish to make and use are universally true. Observations of the.
1 CMSC 671 Fall 2001 Class #21 – Tuesday, November 13.
Reasoning under Uncertainty: Conditional Prob., Bayes and Independence Computer Science cpsc322, Lecture 25 (Textbook Chpt ) Nov, 5, 2012.
Lecture 33, Bayesian Networks Wrap Up Intro to Decision Theory Slide 1.
The famous “sprinkler” example (J. Pearl, Probabilistic Reasoning in Intelligent Systems, 1988)
4 Proposed Research Projects SmartHome – Encouraging patients with mild cognitive disabilities to use digital memory notebook for activities of daily living.
Computer Science CPSC 322 Lecture 27 Conditioning Ch Slide 1.
Computer Science CPSC 502 Lecture 9 (up-to Ch )
QUIZ!!  In HMMs...  T/F:... the emissions are hidden. FALSE  T/F:... observations are independent given no evidence. FALSE  T/F:... each variable X.
Reasoning Under Uncertainty: Independence Jim Little Uncertainty 3 Nov 5, 2014 Textbook §6.2.
Lecture 29 Conditional Independence, Bayesian networks intro Ch 6.3, 6.3.1, 6.5, 6.5.1,
Finish Probability Theory + Bayesian Networks Computer Science cpsc322, Lecture 9 (Textbook Chpt ) June, 5, CPSC 322, Lecture 9.
1 CMSC 671 Fall 2001 Class #20 – Thursday, November 8.
Reasoning Under Uncertainty: Independence CPSC 322 – Uncertainty 3 Textbook §6.2 March 21, 2011.
Today’s Topics Bayesian Networks (BNs) used a lot in medical diagnosis M-estimates Searching for Good BNs Markov Blanket what is conditionally independent.
Reasoning Under Uncertainty: Independence and Inference CPSC 322 – Uncertainty 5 Textbook §6.3.1 (and for HMMs) March 25, 2011.
Bayes network inference  A general scenario:  Query variables: X  Evidence (observed) variables and their values: E = e  Unobserved variables: Y 
CPSC 322, Lecture 26Slide 1 Reasoning Under Uncertainty: Belief Networks Computer Science cpsc322, Lecture 27 (Textbook Chpt 6.3) Nov, 13, 2013.
Reasoning Under Uncertainty: Variable Elimination for Bayes Nets Jim Little Uncertainty 6 Nov Textbook §6.4,
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Reasoning Under Uncertainty: Variable Elimination CPSC 322 – Uncertainty 6 Textbook §6.4.1 March 28, 2011.
Matching ® ® ® Global Map Local Map … … … obstacle Where am I on the global map?                                   
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.
Computer Science CPSC 322 Lecture 19 Bayesian Networks: Construction 1.
Reasoning Under Uncertainty: Belief Networks
Read R&N Ch Next lecture: Read R&N
Reasoning Under Uncertainty: Conditioning, Bayes Rule & Chain Rule
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 14
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 18
Read R&N Ch Next lecture: Read R&N
CS 188: Artificial Intelligence Spring 2007
Reasoning Under Uncertainty: Bnet Inference
CS 188: Artificial Intelligence Fall 2008
Reasoning Under Uncertainty: Bnet Inference
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 14
Probability and Time: Markov Models
Read R&N Ch Next lecture: Read R&N
Presentation transcript:

Reasoning Under Uncertainty: Independence and Inference Jim Little Uncertainty 5 Nov 10, 2014 Textbook §6.3.1, 6.5, 6.5.1, 6.5.2

Lecture Overview Recap: Bayesian Networks Inference in Special Types of Bayesian Networks –Markov Chains –Hidden Markov Models (HMMs) Inference in General Bayesian Networks –Observations and Inference –Time Permitting: Variable elimination 2

Recap: Conditional Independence

Recap: Bayesian Networks, Definition 4 Pa(X i )

Recap: Construction of Bayesian Networks Encoding the joint over {X 1, …, X n } as a Bayesian network: –Totally order the variables: e.g., X 1, …, X n –For every variable X i, find the smallest set of parents Pa(X i )  {X 1, …, X i-1 } such that X i ╨ {X 1, …, X i-1 } \ Pa(X i ) | Pa(X i ) X i is conditionally independent from its other ancestors given its parents –For every variable X i, construct its conditional probability table P(X i | Pa(X i ) ) This has to specify a conditional probability distribution P(X i | Pa(X i ) = pa(X i ) ) for each instantiation pa(X i ) of X i ’s parents 5

Recap: Construction of Bayesian Networks Encoding the JPD over {X 1, …, X n } as a Bayesian network: –Totally order the variables: e.g., X 1, …, X n –For every variable X i, find the smallest set of parents Pa(X i )  {X 1, …, X i-1 } such that X i ╨ {X 1, …, X i-1 } \ Pa(X i ) | Pa(X i ) X i is conditionally independent from its other ancestors given its parents –For every variable X i, construct its conditional probability table P(X i | Pa(X i ) ) This has to specify a conditional probability distribution P(X i | Pa(X i ) = pa(X i ) ) for every instantiation pa(X i ) of X i ‘s parents If a variable has 3 parents each of which has a domain with 4 values, how many instantiations of its parents are there? –4 * 4 * 4 = 4 3 –For each of these 4 3 values we need one probability distribution defined over the values of X i –So need [(|dom(X i )| - 1) * 4 3 ] numbers in total for X i ’s CPT 6

Recap of BN construction with a small example Disease DSymptom SP(D,S) tt tf ft ff Disease DP(D) t0.01 f0.99 Symptom SP(S) t f0.8911

Recap of BN construction with a small example Disease DSymptom SP(D,S) tt tf ft ff Disease Symptom Disease DP(D) t0.01 f0.99 Symptom SP(S) t f0.8911

Recap of BN construction with a small example Which (conditional) probability tables do we need? Disease DSymptom SP(D,S) tt tf ft ff Disease Symptom Disease DP(D) t0.01 f0.99 Symptom SP(S) t f B P(D|S)A P(D)C P(S|D)D P(D,S)

Recap of BN construction with a small example Which conditional probability tables do we need? –P(D) and P(S|D) –In general: for each variable X in the network: P( X|Pa(X) ) Disease DSymptom SP(D,S) tt tf ft ff Disease Symptom Disease DP(D) t0.01 f0.99 Symptom SP(S) t f P(D=t) 0.01 Disease DP(S=t|D) t0.0099/( )=0.99 f0.099/( )=0.1

Recap of BN construction with a small example Disease DSymptom SP(D,S) tt tf ft ff How about a different ordering? Symptom, Disease –We need distributions P(S) and P(D|S) –In general: for each variable X in the network: P( X|Pa(X) ) Disease Symptom P(S=t) Symptom SP(D=t|S) t0.0099/( )= f0.0001/( )= Disease DP(D) t0.01 f0.99 Symptom SP(S) t f0.8911

Remark: where do the conditional probabilities come from? The joint distribution is not normally the starting point –We would have to define exponentially many numbers First define the Bayesian network structure –Either by domain knowledge –Or by machine learning algorithms (see CPSC 540) Typically based on local search Then fill in the conditional probability tables –Either by domain knowledge –Or by machine learning algorithms (see CPSC 340, CPSC 422) Based on statistics over the observed data 12

Lecture Overview Recap: Bayesian Networks Inference in Special Types of Bayesian Networks –Markov Chains –Hidden Markov Models (HMMs) Inference in General Bayesian Networks –Observations and Inference –Time Permitting: Factors and Variable Elimination 13

Markov Chains 14 X0X0 X1X1 X2X2 … The future is independent of the past, given the present.

Stationary Markov Chains A stationary Markov chain is when –All state transition probability tables are the same –I.e., for all t > 0, t’ > 0: P(X t |X t-1 ) = P(X t’ |X t’-1 ) We only need to specify P(X 0 ) and P(X t |X t-1 ). –Simple model, easy to specify –Often the natural model –The network can extend indefinitely in time Example: Drunkard’s walk, robot random motion 15 X0X0 X1X1 X2X2 …

Lecture Overview Recap: Bayesian Networks Inference in Special Types of Bayesian Networks –Markov Chains –Hidden Markov Models (HMMs) Inference in General Bayesian Networks –Observations and Inference –Time Permitting: Factors and Variable Elimination 16

Hidden Markov Models (HMMs) A Hidden Markov Model (HMM) is a stationary Markov chain plus a noisy observation about the state at each time step: 17 O1O1 X0X0 X1X1 O2O2 X2X2 …

Example HMM: Robot Tracking Robot tracking as an HMM: 18 Sens 1 Pos 0 Pos 1 Sens 2 Pos 2 Robot is moving at random: P(Pos t |Pos t-1 ) Sensor observations of the current state P(Sens t |Pos t ) …

Filtering in Hidden Markov Models (HMMs) 19 O1O1 X0X0 X1X1 O2O2 X2X2 Filtering problem in HMMs: at time step t, we would like to know P(X t |o 1, …, o t ) We can derive simple update equations for this belief state: –We are given P(X 0 ) (i.e., P(X 0 | {}) –We can compute P(X t |O 1, …, O t ) if we know P(X t-1 |o 1, …, o t-1 ) –Simple example of dynamic programming –See P&M text Section (not responsible for this for exam!) …

Lecture Overview Recap: Bayesian Networks Inference in Special Types of Bayesian Networks –Markov Chains –Hidden Markov Models (HMMs) Inference in General Bayesian Networks –Observations and Inference –Time Permitting: Factors and Variable Elimination 20

Bayesian Networks: Incorporating Observations In the special case of Hidden Markov Models (HMMs): –we could easily incorporate observations –and do efficient inference (in particular: filtering) Back to general Bayesian Networks –We can still incorporate observations –And we can still do (fairly) efficient inference 21

Bayesian Networks: Incorporating Observations We denote observed variables as shaded. Examples: 22 O1O1 X0X0 X1X1 O2O2 X2X2 Understood Material Assignment Grade Exam Grade Alarm Smoking At Sensor Fire

Bayesian Networks: Types of Inference Diagnostic People are leaving L=t P(F|L=t)=? PredictiveIntercausal Mixed Fire happens F=t P(L|F=t)=? Alarm goes off P(a) = 1.0 P(F|A=t,T=t)=? People are leaving L=t There is no fire F=f P(A|F=f,L=t)=? Person smokes next to sensor S=t Fire Alarm Leaving Fire Alarm Leaving Fire Alarm Leaving Fire Alarm Smoking at Sensor We will use the same reasoning procedure for all of these types

Inference in Bayesian Networks Given: –A Bayesian Network BN, and –Observations of a subset of its variables E: E=e –A subset of its variables Y that is queried Compute: The conditional probability P(Y|E=e) How: Run variable elimination algorithm N.B. We can already do all this: See lecture “Uncertainty2” Inference by Enumeration topic. The BN represents the JPD. Could just multiply out the BN to get full JPD and then do Inference by Enumeration BUT that’s extremely inefficient - does not scale. 24

Lecture Overview Inference in General Bayesian Networks –Factors: Assigning Variables Summing out Variables Multiplication of Factors –The variable elimination algorithm 25

Factors A factor is a function from a tuple of random variables to the real numbers R We write a factor on variables X 1,…,X j as f(X 1,…,X j ) P(Z|X,Y) is a factor f (X,Y,Z) –Factors do not have to sum to one –P(Z|X,Y) is a set of probability distributions: one for each combination of values of X and Y P(Z=f|X,Y) is a factor f(X,Y) 26 XYZval ttt0.1 ttf0.9 tft0.2 tff0.8 ftt0.4 ftf0.6 fft0.3 fff0.7 f(X, Y ) Z=f

Operation 1: assigning a variable We can make new factors out of an existing factor Our first operation: we can assign some or all of the variables of a factor. XYZval ttt0.1 ttf0.9 tft0.2 f(X,Y,Z):tff0.8 ftt0.4 ftf0.6 fft0.3 fff0.7 What is the result of assigning X= t ? f(X=t,Y,Z) =f(X, Y, Z) X = t YZval tt0.1 tf0.9 ft0.2 ff0.8 Factor of Y, Z 27

28 More examples of assignment XYZval ttt0.1 ttf0.9 tft0.2 f(X,Y,Z):tff0.8 ftt0.4 ftf0.6 fft0.3 fff0.7 YZval tt0.1 tf0.9 ft0.2 ff0.8 Yval t0.9 f0.8 f(X=t,Y=f,Z=f):0.8 f(X=t,Y,Z) f(X=t,Y,Z=f): Factor of Y,Z Factor of Y Number

Operation 2: Summing out a variable Our second operation on factors: we can marginalize out (or sum out) a variable –Exactly as before. Only difference: factors don’t sum to 1 –Marginalizing out a variable X from a factor f(X 1,…,X n ) yields a new factor defined on {X 1,…,X n } \ {X} BACval ttt0.03 ttf0.07 ftt0.54 ftf0.36 f3=f3=tft0.06 tff0.14 fft0.48 fff0.32 ACval tt0.57 tf0.43 ft0.54 ff0.46 (  B f 3 )(A,C) 29

Operation 3: multiplying factors 30 ABCval ttt 0.03 ttf 0.1x0.7 tft 0.9x0.6 tff… ftt ftf fft fff ABVal tt0.1 f 1 (A,B):tf0.9 ft0.2 ff0.8 BCVal tt0.3 f 2 (B,C):tf0.7 ft0.6 ff0.4 f 1 (A,B)× f 2 (B,C):

Operation 3: multiplying factors 31

Build a Bayesian Network for a given domain Understand basics of Markov Chains and Hidden Markov Models Classify the types of inference: –Diagnostic, Predictive, Mixed, Intercausal Understand factors 32 Learning Goals For Today’s Class