Reasoning Under Uncertainty: Variable Elimination Example


 Camron Watkins
 1 years ago
 Views:
Transcription
1 Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29 March 26, 2007 Textbook 9.5 Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 1
2 Lecture Overview 1 Recap 2 More Variable Elimination 3 Variable Elimination Example Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 2
3 Summing out variables Our second operation: we can sum out a variable, say X 1 with domain {v 1,..., v k }, from factor f(x 1,..., X j ), resulting in a factor on X 2,..., X j defined by: ( X 1 f)(x 2,..., X j ) = f(x 1 = v 1,..., X j ) + + f(x 1 = v k,..., X j ) Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 3
4 Multiplying factors Our third operation: factors can be multiplied together. The product of factor f 1 (X, Y ) and f 2 (Y, Z), where Y are the variables in common, is the factor (f 1 f 2 )(X, Y, Z) defined by: (f 1 f 2 )(X, Y, Z) = f 1 (X, Y )f 2 (Y, Z). Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 4
5 Probability of a conjunction Suppose the variables of the belief network are X 1,..., X n. {X 1,..., X n } = {Q} {Y 1,..., Y j } {Z 1,..., k } Q is the query variable {Y 1,..., Y j } is the set of observed variables {Z 1,..., k } is the rest of the variables, that are neither queried nor observed What we want to compute: P (Q, Y 1 = v 1,..., Y j = v j ) We can compute P (Q, Y 1 = v 1,..., Y j = v j ) by summing out each variable Z 1,..., Z k We sum out these variables one at a time the order in which we do this is called our elimination ordering. P (Q, Y 1 = v 1,..., Y j = v j ) = Z k Z 1 P (X 1,..., X n ) Y1 = v 1,...,Y j = v j. Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 5
6 Probability of a conjunction What we know: the factors P (X i px i ). Using the chain rule and the definition of a belief network, we can write P (X 1,..., X n ) as n i=1 P (X i px i ). Thus: P (Q, Y 1 = v 1,..., Y j = v j ) = Z k P (X 1,..., X n ) Y1 = v 1,...,Y j = v j. Z 1 = n P (X i px i ) Y1 = v 1,...,Y j = v j. Z k Z 1 i=1 Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 6
7 Computing sums of products Computation in belief networks thus reduces to computing the sums of products. It takes 14 multiplications or additions to evaluate the expression ab + ac + ad + aeh + afh + agh. How can this expression be evaluated more efficiently? factor out the a and then the h giving a(b + c + d + h(e + f + g)) this takes only 7 multiplications or additions ( How can we compute n Z 1 i=1 P (X i px i ) efficiently? Factor out those terms that don t involve Z 1 : )( ) P (X i px i ) P (X i px i ) i Z 1 {X i} px i (terms that do not involve Z i ) Z 1 i Z 1 {X i} px i (terms that involve Z i ) Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 7
8 Lecture Overview 1 Recap 2 More Variable Elimination 3 Variable Elimination Example Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 8
9 Summing out a variable efficiently To sum out a variable Z j from a product f 1,..., f k of factors: Partition the factors into those that don t contain Z j, say f 1,..., f i, those that contain Z j, say f i+1,..., f k We know: f 1 f k = (f 1 f i ) f i+1 f k. Z j Zj ( ) f Zj i+1 f k is a new factor; let s call it f. Now we have: Z j f 1 f k = f 1 f i f. Store f explicitly, and discard f i+1,..., f k. Now we ve summed out Z j. Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 9
10 Variable elimination algorithm To compute P (Q Y 1 = v 1... Y j = v j ): Construct a factor for each conditional probability. Set the observed variables to their observed values. For each of the other variables Z i {Z 1,..., Z k }, sum out Z i Multiply the remaining factors. Normalize by dividing the resulting factor f(q) by Q f(q). Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 10
11 Lecture Overview 1 Recap 2 More Variable Elimination 3 Variable Elimination Example Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 11
12 Variable elimination example A Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P P (G, H) = A,B,C,D,E,F,I P (A, B, C, D, E, F, G, H, I) P P (G, H) = A,B,C,D,E,F,I P (A) P (B A) P (C) P (D B, C) P (E C) P (F D) P (G F, E) P (H G) P (I G) B D F C E G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
13 Variable elimination example Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P P (G, H) = A,B,C,D,E,F,I P (A) P (B A) P (C) P (D B, C) P (E C) P (F D) P (G F, E) P (H G) P (I G) P Eliminate A: P (G, H) = B,C,D,E,F,I f1(b) P (C) P (D B, C) P (E C) P (F D) P (G F, E) P (H G) P (I G) A P f 1(B) := a dom(a) P (A = a) P (B A = a) B D F C E G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
14 Variable elimination example Compute P (G H P = h 1 ). Elimination order: A, C, E, H, I, B, D, F P (G, H) = B,C,D,E,F,I f1(b) P (C) P (D B, C) P (E C) P (F D) P (G F, E) P (H G) P (I G) Eliminate C: P (G, H) = P B,D,E,F,I f1(b) f2(b, D, E) P (F D) P (G F, E) P (H G) P (I G) A B D F C E P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P (C = c) P (D B, C = c) P (E C = c) G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
15 Variable elimination example Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P(G, H) = f1(b) f2(b, D, E) P (F D) P (G F, E) P (H G) P (I G) B,D,E,F,I Eliminate E: P P (G, H) = B,D,F,I f1(b) f3(b, D, F, G) P (F D) P (H G) P (I G) A B D F C E P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
16 Variable elimination example Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P P (G, H) = B,D,F,I f1(b) f3(b, D, F, G) P (F D) P (H G) P (I G) Observe H = h 1: P P (G, H = h 1) = B,D,F,I f1(b) f3(b, D, F, G) P (F D) f4(g) P (I G) A B D F C E P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
17 Variable elimination example Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P P (G, H = h 1) = B,D,F,I f1(b) f3(b, D, F, G) P (F D) f4(g) P (I G) Eliminate I: P P (G, H = h 1) = B,D,F f1(b) f3(b, D, F, G) P (F D) f4(g) f5(g) A B D F C E P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) P f 5(G) := i dom(i) P (I = i G) G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
18 Variable elimination example Compute P (G H = P h 1 ). Elimination order: A, C, E, H, I, B, D, F P (G, H = h 1) = B,D,F f1(b) f3(b, D, F, G) P (F D) f4(g) f5(g) Eliminate B: P P (G, H = h 1) = D,F f6(d, F, G) P (F D) f4(g) f5(g) A B D F C E P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) P f 5(G) := i dom(i) P P (I = i G) f 6(D, F, G) := b dom(b) f1(b = b) f3(b = b, D, F, G) G H I Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
19 Variable elimination example Compute P (G H = P h 1 ). Elimination order: A, C, E, H, I, B, D, F P (G, H = h 1) = D,F f6(d, F, P G) P (F D) f4(g) f5(g) Eliminate D: P (G, H = h 1) = F f7(f, G) f4(g) f5(g) A B D F H G C E I P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) P f 5(G) := i dom(i) P P (I = i G) f 6(D, F, G) := P b dom(b) f1(b = b) f3(b = b, D, F, G) f 7(F, G) := d dom(d) f6(d = d, F, G) P (F D = d) Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
20 Variable elimination example Compute P (G H = P h 1 ). Elimination order: A, C, E, H, I, B, D, F P (G, H = h 1) = F f7(f, G) f4(g) f5(g) Eliminate F : P (G, H = h 1) = f 8(G) f 4(G) f 5(G) A B D F H G C E I P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) P f 5(G) := i dom(i) P P (I = i G) f 6(D, F, G) := P b dom(b) f1(b = b) f3(b = b, D, F, G) f 7(F, G) := d dom(d) f6(d = d, F, G) P (F D = d) P f 8(G) := f dom(f ) f7(f = f, G) Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
21 Variable elimination example Compute P (G H = h 1 ). Elimination order: A, C, E, H, I, B, D, F P (G, H = h 1) = f 8(G) f 4(G) f 5(G) Normalize: P (G H = h 1) = P (G,H = h 1 ) Pg dom(g) P (G,H = h 1) A B D F H G C E I P f 1(B) := a dom(a) P P (A = a) P (B A = a) f 2(B, D, E) := c dom(c) P P (C = c) P (D B, C = c) P (E C = c) f 3(B, D, F, G) := e dom(e) f2(b, D, E = e) P (G F, E = e) f 4(G) := P (H = h 1 G) P f 5(G) := i dom(i) P P (I = i G) f 6(D, F, G) := P b dom(b) f1(b = b) f3(b = b, D, F, G) f 7(F, G) := d dom(d) f6(d = d, F, G) P (F D = d) P f 8(G) := f dom(f ) f7(f = f, G) Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 12
22 What good was Conditional Independence? That s great... but it looks incredibly painful for large graphs. And... why did we bother learning conditional independence? Does it help us at all? Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 13
23 What good was Conditional Independence? That s great... but it looks incredibly painful for large graphs. And... why did we bother learning conditional independence? Does it help us at all? yes we use the chain rule decomposition right at the beginning Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 13
24 What good was Conditional Independence? That s great... but it looks incredibly painful for large graphs. And... why did we bother learning conditional independence? Does it help us at all? yes we use the chain rule decomposition right at the beginning Can we use our knowledge of conditional independence to make this calculation even simpler? Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 13
25 What good was Conditional Independence? That s great... but it looks incredibly painful for large graphs. And... why did we bother learning conditional independence? Does it help us at all? yes we use the chain rule decomposition right at the beginning Can we use our knowledge of conditional independence to make this calculation even simpler? yes there are some variables that we don t have to sum out intuitively, they re the ones that are presummedout in our tables example: summing out I on the previous slide Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 13
26 One Last Trick One last trick to simplify calculations: we can repeatedly eliminate all leaf nodes that are neither observed nor queried, until we reach a fixed point. Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 14
27 One Last Trick One last trick to simplify calculations: we can repeatedly eliminate all leaf nodes that are neither observed nor queried, until we reach a fixed point. alarm fire smoke Can we justify that on a threenode graph Fire, Alarm, and Smoke when we ask for: P (F ire)? Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 14
28 One Last Trick One last trick to simplify calculations: we can repeatedly eliminate all leaf nodes that are neither observed nor queried, until we reach a fixed point. alarm fire smoke Can we justify that on a threenode graph Fire, Alarm, and Smoke when we ask for: P (F ire)? P (F ire Alarm)? Reasoning Under Uncertainty: Variable Elimination Example CPSC 322 Lecture 29, Slide 14
Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)
Chapter 23 Squares Modulo p Revised Version of Chapter 23 We learned long ago how to solve linear congruences ax c (mod m) (see Chapter 8). It s now time to take the plunge and move on to quadratic equations.
More informationCritical points of once continuously differentiable functions are important because they are the only points that can be local maxima or minima.
Lecture 0: Convexity and Optimization We say that if f is a once continuously differentiable function on an interval I, and x is a point in the interior of I that x is a critical point of f if f (x) =
More informationMEP Y9 Practice Book A
1 Base Arithmetic 1.1 Binary Numbers We normally work with numbers in base 10. In this section we consider numbers in base 2, often called binary numbers. In base 10 we use the digits 0, 1, 2, 3, 4, 5,
More informationSimplifying Logic Circuits with Karnaugh Maps
Simplifying Logic Circuits with Karnaugh Maps The circuit at the top right is the logic equivalent of the Boolean expression: f = abc + abc + abc Now, as we have seen, this expression can be simplified
More informationHow Old Are They? This problem gives you the chance to: form expressions form and solve an equation to solve an age problem. Will is w years old.
How Old Are They? This problem gives you the chance to: form expressions form and solve an equation to solve an age problem Will is w years old. Ben is 3 years older. 1. Write an expression, in terms of
More informationIf A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?
Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question
More informationFigure 2.1: Center of mass of four points.
Chapter 2 Bézier curves are named after their inventor, Dr. Pierre Bézier. Bézier was an engineer with the Renault car company and set out in the early 196 s to develop a curve formulation which would
More informationProbability Review Solutions
Probability Review Solutions. A family has three children. Using b to stand for and g to stand for, and using ordered triples such as bbg, find the following. a. draw a tree diagram to determine the sample
More informationFigure out the early start and early finish. Early start. Early finish
Figure out the early start and early finish oming up with the float for each activity is useful, but you can actually do better! When you have a long critical path, but the other paths in your network
More informationTHE CONGRUENT NUMBER PROBLEM
THE CONGRUENT NUMBER PROBLEM KEITH CONRAD 1. Introduction A right triangle is called rational when its legs and hypotenuse are all rational numbers. Examples of rational right triangles include Pythagorean
More informationSwitching Algebra and Logic Gates
Chapter 2 Switching Algebra and Logic Gates The word algebra in the title of this chapter should alert you that more mathematics is coming. No doubt, some of you are itching to get on with digital design
More informationYou know from calculus that functions play a fundamental role in mathematics.
CHPTER 12 Functions You know from calculus that functions play a fundamental role in mathematics. You likely view a function as a kind of formula that describes a relationship between two (or more) quantities.
More informationSelecting a Subset of Cases in SPSS: The Select Cases Command
Selecting a Subset of Cases in SPSS: The Select Cases Command When analyzing a data file in SPSS, all cases with valid values for the relevant variable(s) are used. If I opened the 1991 U.S. General Social
More informationApproximating functions by Taylor Polynomials.
Chapter 4 Approximating functions by Taylor Polynomials. 4.1 Linear Approximations We have already seen how to approximate a function using its tangent line. This was the key idea in Euler s method. If
More informationCritical analysis. Be more critical! More analysis needed! That s what my tutors say about my essays. I m not really sure what they mean.
Critical analysis Be more critical! More analysis needed! That s what my tutors say about my essays. I m not really sure what they mean. I thought I had written a really good assignment this time. I did
More informationThe Chinese Restaurant Process
COS 597C: Bayesian nonparametrics Lecturer: David Blei Lecture # 1 Scribes: Peter Frazier, Indraneel Mukherjee September 21, 2007 In this first lecture, we begin by introducing the Chinese Restaurant Process.
More informationJust want the standards alone? You can find the standards alone at http://corestandards.org/thestandards
4 th Grade Mathematics Unpacked Content For the new Common Core State Standards that will be effective in all North Carolina schools in the 201213 school year. This document is designed to help North
More informationPaying Off your Mortgage
ABCs of Mortgages Series Paying Off your Mortgage Faster Smart mortgage decisions start here Table of Contents Overview 1 Understanding principal versus interest 1 Ways to pay off your mortgage faster
More informationLevel 15: Creating a Puzzle
Level 15: Creating a Puzzle Welcome to Level 15 of the RPG Maker VX Introductory Course. In Level 14 we drew the map for the Good King s Lair and then set some traps. In this level we will create a puzzle
More information= 2 + 1 2 2 = 3 4, Now assume that P (k) is true for some fixed k 2. This means that
Instructions. Answer each of the questions on your own paper, and be sure to show your work so that partial credit can be adequately assessed. Credit will not be given for answers (even correct ones) without
More informationFindTheNumber. 1 FindTheNumber With Comps
FindTheNumber 1 FindTheNumber With Comps Consider the following twoperson game, which we call FindTheNumber with Comps. Player A (for answerer) has a number x between 1 and 1000. Player Q (for questioner)
More informationFinding the M Most Probable Configurations Using Loopy Belief Propagation
Finding the M Most Probable Configurations Using Loopy Belief Propagation Chen Yanover and Yair Weiss School of Computer Science and Engineering The Hebrew University of Jerusalem 91904 Jerusalem, Israel
More informationWHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?
WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT? introduction Many students seem to have trouble with the notion of a mathematical proof. People that come to a course like Math 216, who certainly
More informationONEDIMENSIONAL RANDOM WALKS 1. SIMPLE RANDOM WALK
ONEDIMENSIONAL RANDOM WALKS 1. SIMPLE RANDOM WALK Definition 1. A random walk on the integers with step distribution F and initial state x is a sequence S n of random variables whose increments are independent,
More informationConditionals with Cards adapted from Code Studio, Course 2
adapted from Code Studio, Course 2 Created in Partnership with Revision 141011.1a Lesson time: approximately 1 hour. LESSON OVERVIEW We don t always know ahead of time what things will be like when we
More information(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.
(LMCS, p. 317) V.1 First Order Logic This is the most powerful, most expressive logic that we will examine. Our version of firstorder logic will use the following symbols: variables connectives (,,,,
More informationThe Backpropagation Algorithm
7 The Backpropagation Algorithm 7. Learning as gradient descent We saw in the last chapter that multilayered networks are capable of computing a wider range of Boolean functions than networks with a single
More informationMaintaining Knowledge about Temporal Intervals
/ESEARCH COKrNBlmONS Maintaining Knowledge about Temporal Intervals JAMES F. ALLEN The University of Rochester lames F. Allen's main interests are in artificial intelligence in particular natural language
More informationPoisson processes (and mixture distributions)
Poisson processes (and mixture distributions) James W. Daniel Austin Actuarial Seminars www.actuarialseminars.com June 26, 2008 c Copyright 2007 by James W. Daniel; reproduction in whole or in part without
More informationSample only. STOP for Each Other. Unit 1: Introduction SAFETY TRAINING OBSERVATION PROGRAM. Name:
Unit 1: Introduction Name: SAFETY STOP for Each Other TRAINING OBSERVATION PROGRAM Note to Readers The authors, reviewers, editors and DuPont have made extensive efforts to ensure that the technology,
More information