Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 2009.

Similar presentations


Presentation on theme: "CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 2009."— Presentation transcript:

1 CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 2009

2 CPSC 322, Lecture 30Slide 2 Lecture Overview Recap Intro Variable Elimination Variable Elimination Simplifications Example Independence Where are we?

3 CPSC 322, Lecture 29Slide 3 Bnet Inference: General Suppose the variables of the belief network are X 1,…,X n. Z is the query variable Y 1 =v 1, …, Y j =v j are the observed variables (with their values) Z 1, …,Z k are the remaining variables What we want to compute: We can actually compute:

4 CPSC 322, Lecture 29Slide 4 Inference with Factors We can compute P(Z, Y 1 =v 1, …,Y j =v j ) by expressing the joint as a factor, f (Z, Y 1 …,Y j, Z 1 …,Z j ) assigning Y 1 =v 1, …, Y j =v j and summing out the variables Z 1, …,Z k

5 CPSC 322, Lecture 29Slide 5 Variable Elimination Intro (1) We can express the joint factor as a product of factors Using the chain rule and the definition of a Bnet, we can write P(X 1, …, X n ) as f(Z, Y 1 …,Y j, Z 1 …,Z j )

6 CPSC 322, Lecture 29Slide 6 Variable Elimination Intro (2) 1.Construct a factor for each conditional probability. 2.In each factor assign the observed variables to their observed values. 3.Multiply the factors 4.For each of the other variables Z i ∈ {Z 1, …, Z k }, sum out Z i Inference in belief networks thus reduces to computing “the sums of products….”

7 CPSC 322, Lecture 30Slide 7 Lecture Overview Recap Intro Variable Elimination Variable Elimination Simplifications Example Independence Where are we?

8 CPSC 322, Lecture 30Slide 8 How to simplify the Computation? Assume we have turned the CPTs into factors and performed the assignments Let’s focus on the basic case, for instance…

9 CPSC 322, Lecture 30Slide 9 How to simplify: basic case Let’s focus on the basic case. How can we compute efficiently? Factor out those terms that don't involve Z 1 !

10 CPSC 322, Lecture 30Slide 10 General case: Summing out variables efficiently Now to sum out a variable Z 2 from a product f 1 ×… ×f i × f’ of factors, again partition the factors into two sets F: those that

11 CPSC 322, Lecture 30Slide 11 Analogy with “Computing sums of products” This simplification is similar to what you can do in basic algebra with multiplication and addition It takes 14 multiplications or additions to evaluate the expression a b + a c + a d + a e h + a f h + a g h. This expression be evaluated more efficiently….

12 CPSC 322, Lecture 30Slide 12 Variable elimination ordering P(G,D=t) =  A,B,C, f(A,G) f(B,A) f(C,G) f(B,C) P(G,D=t) =  A f(A,G)  B f(B,A)  C f(C,G) f(B,C) P(G,D=t) =  A f(A,G)  C f(C,G)  B f(B,C) f(B,A) Is there only one way to simplify?

13 CPSC 322, Lecture 30Slide 13 Variable elimination algorithm: Summary To compute P(Z| Y 1 =v 1,…,Y j =v j ) : 1.Construct a factor for each conditional probability. 2.Set the observed variables to their observed values. 3.Given an elimination ordering, simplify/decompose sum of products 4.Perform products and sum out Z i 5.Multiply the remaining factors (all in ? ) 6.Normalize: divide the resulting factor f(Z) by  Z f(Z). P(Z, Y 1 …,Y j, Z 1 …,Z j )

14 CPSC 322, Lecture 30Slide 14 Lecture Overview Recap Intro Variable Elimination Variable Elimination Simplifications Example Independence Where are we?

15 CPSC 322, Lecture 30Slide 15 Variable elimination example Compute P(G | H=h 1 ). P(G,H) =  A,B,C,D,E,F,I P(A,B,C,D,E,F,G,H,I)

16 CPSC 322, Lecture 30Slide 16 Variable elimination example Compute P(G | H=h 1 ). P(G,H) =  A,B,C,D,E,F,I P(A,B,C,D,E,F,G,H,I) Chain Rule + Conditional Independence: 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)

17 CPSC 322, Lecture 30Slide 17 Variable elimination example (step1) Compute P(G | H=h 1 ). 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) Factorized Representation: P(G,H) =  A,B,C,D,E,F,I f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

18 CPSC 322, Lecture 30Slide 18 Variable elimination example (step 2) Compute P(G | H=h 1 ). Previous state: P(G,H) =  A,B,C,D,E,F,I f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G) Observe H : P(G,H=h 1 ) =  A,B,C,D,E,F,I f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 9 (G) f 8 (I,G) f 9 (G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

19 CPSC 322, Lecture 30Slide 19 Variable elimination example (steps 3-4) Compute P(G | H=h 1 ). Previous state: P(G,H) =  A,B,C,D,E,F,I f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 9 (G) f 8 (I,G) Elimination ordering A, C, E, I, B, D, F : P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B  I f 8 (I,G)  E f 6 (G,F,E)  C f 2 (C) f 3 (D,B,C) f 4 (E,C)  A f 0 (A) f 1 (B,A) f 9 (G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

20 CPSC 322, Lecture 30Slide 20 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B  I f 8 (I,G)  E f 6 (G,F,E)  C f 2 (C) f 3 (D,B,C) f 4 (E,C)  A f 0 (A) f 1 (B,A) Eliminate A: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B f 10 (B)  I f 8 (I,G)  E f 6 (G,F,E)  C f 2 (C) f 3 (D,B,C) f 4 (E,C) f 9 (G) f 10 (B) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

21 CPSC 322, Lecture 30Slide 21 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B f 10 (B)  I f 8 (I,G)  E f 6 (G,F,E)  C f 2 (C) f 3 (D,B,C) f 4 (E,C) Eliminate C: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B f 10 (B)  I f 8 (I,G)  E f 6 (G,F,E) f 12 (B,D,E) f 9 (G) f 10 (B) f 12 (B,D,E) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

22 CPSC 322, Lecture 30Slide 22 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B f 10 (B)  I f 8 (I,G)  E f 6 (G,F,E) f 12 (B,D,E) Eliminate E: P(G,H=h 1 ) =f 9 (G)  F  D f 5 (F, D)  B f 10 (B) f 13 (B,D,F,G)  I f 8 (I,G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

23 CPSC 322, Lecture 30Slide 23 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G)  F  D f 5 (F, D)  B f 10 (B) f 13 (B,D,F,G)  I f 8 (I,G) Eliminate I: P(G,H=h 1 ) =f 9 (G) f 14 (G)  F  D f 5 (F, D)  B f 10 (B) f 13 (B,D,F,G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

24 CPSC 322, Lecture 30Slide 24 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G) f 14 (G)  F  D f 5 (F, D)  B f 10 (B) f 13 (B,D,F,G) Eliminate B: P(G,H=h 1 ) = f 9 (G) f 14 (G)  F  D f 5 (F, D) f 15 (D,F,G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 15 (D,F,G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

25 CPSC 322, Lecture 30Slide 25 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G) f 14 (G)  F  D f 5 (F, D) f 15 (D,F,G) Eliminate D: P(G,H=h 1 ) =f 9 (G) f 14 (G)  F f 16 (F, G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 15 (D,F,G) f 16 (F, G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

26 CPSC 322, Lecture 30Slide 26 Variable elimination example(steps 3-4) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G) f 14 (G)  F f 16 (F, G) Eliminate F: P(G,H=h 1 ) = f 9 (G) f 14 (G) f 17 (G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 15 (D,F,G) f 16 (F, G) f 17 (G) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

27 CPSC 322, Lecture 30Slide 27 Variable elimination example (step 5) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 9 (G) f 14 (G) f 17 (G ) Multiply remaining factors: P(G,H=h 1 ) = f 18 (G ) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 15 (D,F,G) f 16 (F, G ) f 17 (G ) f 18 (G ) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

28 CPSC 322, Lecture 30Slide 28 Variable elimination example (step 6) Compute P(G | H=h 1 ). Elimination ordering A, C, E, I, B, D, F. Previous state: P(G,H=h 1 ) = f 18 (G) Normalize: P(G | H=h 1 ) = f 18 (G) /  g ∈ dom(G) f 18 (G) f 9 (G) f 10 (B) f 12 (B,D,E) f 13 (B,D,F,G) f 14 (G) f 15 (D,F,G) f 16 (F, G ) f 17 (G ) f 18 (G ) f 0 (A) f 1 (B,A) f 2 (C) f 3 (D,B,C) f 4 (E,C) f 5 (F, D) f 6 (G,F,E) f 7 (H,G) f 8 (I,G)

29 CPSC 322, Lecture 30Slide 29 Lecture Overview Recap Intro Variable Elimination Variable Elimination Simplifications Example Independence Where are we?

30 CPSC 322, Lecture 30Slide 30 Variable elimination and conditional independence Variable Elimination looks incredibly painful for large graphs? We used conditional independence….. Can we use it to make variable elimination simpler? Yes, all the variables from which the query is conditional independent given the observations can be pruned from the Bnet

31 CPSC 322, Lecture 30Slide 31 VE and conditional independence: Example All the variables from which the query is conditional independent given the observations can be pruned from the Bnet e.g., P(G | H=v 1, F= v 2, C=v 3 ).

32 CPSC 322, Lecture 4Slide 32 Learning Goals for today’s class You can: Carry out variable elimination by using factor representation and using the factor operations. Use techniques to simplify variable elimination.

33 CPSC 322, Lecture 2Slide 33 Big Picture: R&R systems Environment Problem Query Planning Deterministic Stochastic Search Arc Consistency Search Value Iteration Var. Elimination Constraint Satisfaction Logics STRIPS Belief Nets Vars + Constraints Decision Nets Markov Processes Var. Elimination Static Sequential Representation Reasoning Technique SLS

34 CPSC 322, Lecture 18Slide 34 Answering Query under Uncertainty Static Belief Network & Variable Elimination Dynamic Bayesian Network Probability Theory Hidden Markov Models Email spam filters Diagnostic Systems (e.g., medicine) Natural Language Processing Student Tracing in tutoring Systems Monitoring (e.g credit cards) BioInformatics

35 CPSC 322, Lecture 29Slide 35 Next Class Probability and Time (TextBook 6.5) Two Practice Exercises on Bnet available. Assignment 4 will be available on Wednesday and due on Apr the 8 th (last class). Course Elements


Download ppt "CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 2009."

Similar presentations


Ads by Google