lectur ture 2 e 23 planni anning u ng under er u uncer
play

Lectur ture 2 e 23 Planni anning U ng Under er U Uncer ertai - PowerPoint PPT Presentation

Computer Science CPSC 322 Lectur ture 2 e 23 Planni anning U ng Under er U Uncer ertai tainty nty a and Decision N on Networ works 1 Announ nouncem emen ents Final exam Mon, Dec. 18, 12noon Same general format as


  1. Computer Science CPSC 322 Lectur ture 2 e 23 Planni anning U ng Under er U Uncer ertai tainty nty a and Decision N on Networ works 1

  2. Announ nouncem emen ents • Final exam • Mon, Dec. 18, 12noon • Same general format as midterm  Part short questions, part longer problems  List from which I will draw the short questions is posted on Connect (“Final” folder)  I will also post there some Practice problems  Covers material from the beginning of the course  See list of posted learning goals for what you should know Office hours will continue as usual after the end of • classes

  3. Lect cture re Overvi rview • Recap • Intro to Decision theory • Utility and expected utility • Decision Networks for Single-stage decision problems 3

  4. Inf nference in n Gen eneral • Y: subset of variables that is queried (e.g. Temperature in previous example) • E: subset of variables that are observed . E = e ( W = yes in previous example) • Z 1 , …,Z k remaining variables in the JPD ( Cloudy in previous example) We need to compute this numerator for each value of Y, Y, y i We need to marginalize over all the variables Z 1 ,…Z k not involved in the query ∑ ∑ = = = … = = P ( Y y , E e ) ... P(Z , ,Z ,Y y ,E e) i 1 k i Z Z 1 k = Def of conditional P ( Y , E e ) = = P ( Y | E e ) probability = P ( E e ) = To compute the denominator, marginalize over Y P ( Y , E e ) - Same value for every P(Y=y i ). Normalization ∑ = P ( Y , E e ) constant ensuring that ∑ = = P(Y y | E ) 1 i Y Y • All we need to compute is the numerator: joint probability of the query variable(s) and the evidence! • Variable Elimination is an algorithm that efficiently performs this operation by casting it as operations between factors - introduced next

  5. Factors Fa • 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 ) • A factor denotes one or more (possibly partial) distributions over the given tuple of variables, e.g., • P(X 1 , X 2 ) is a factor f(X 1 , X 2 ) Distribution X Y Z val Set of Distributions t t t 0.1 • P(Z | X,Y) is a factor One for each combination t t f 0.9 of values for X and Y f(Z,X,Y) t f t 0.2 t f f 0.8 • P(Z=f|X,Y) is a factor f(X,Y) f(X, Y ) Z = f f t t 0.4 f t f 0.6 Set of partial Distributions f f t 0.3 • Note: Factors do not have to sum to one f f f 0.7

  6. Rec ecap: F Fac actors and and Ope perations on T on Them hem If we assign variable A=a in factor f 7 (A,B), what is the correct form for the resulting factor? • f(B). When we assign variable A we remove it from the factor’s domain If we marginalize variable A out from factor f 7 (A,B), what is the correct form for the resulting factor? • f(B). When we marginalize out variable A we remove it from the factor’s domain If we multiply factors f 4 (X,Y) and f 6 (Z,Y), what is the correct form for the resulting factor? • f(X,Y,Z) • When multiplying factors, the resulting factor’s domain is the union of the multiplicands’ domains What is the correct form for ∑ B f 5 (A,B) × f 6 (B,C) • • As usual, product before sum: ∑ B ( f 5 (A,B) × f 6 (B,C) ) • Result of multiplication: f 7 (A,B,C). Then marginalize out B: f 8 (A,C)

  7. Th The e variable elimi mination algo gorithm, n ∏ … = The JPD of a Bayesian network is P( X , , X ) P ( X | pa ( X ) ) 1 n i i = i 1 observed Other variables not involved in the query Given: P(Y, E 1 …, E j , Z 1 …,Z k ) = = … = P ( Y y , E e , , E e ) i 1 1 j j To compute P(Y=y i | E 1 =e 1 , …, E j =e j ) = ∑ = = … = P ( Y y , E e , , E e ) 1 1 j j = Y y = 1. Construct a factor for each conditional probability. P ( X | pa ( X )) f ( X , pa ( X )) i i i i i n ∑ ∑∏ = = =   P ( Y , E e , , E e ) ( f ) = = 1 1 j j i E e ,  , E e 1 1 j j = Z Z i 1 k 1 2. For each factor, assign the observed variables E to their observed values. 3. Given an elimination ordering, decompose sum of products 4. 4. Sum um out out all variables Z i not involved in the query (one a time) • Multiply factors containing Z i • Then marginalize out Z i from the product 5. Multiply the remaining factors (which only involve Y ) ∑ f ( Y ) y

  8. The variable elimination algorithm, n ∏ … = The JPD of a Bayesian network is P( X , , X ) P ( X | pa ( X ) ) 1 n i i = i 1 observed Other variables not involved in the query Given: P(Y, E 1 …, E j , Z 1 …,Z k ) = = … = P ( Y y , E e , , E e ) i 1 1 j j To compute P(Y=y i | E 1 =e 1 , …, E j =e j ) = ∑ = = … = P ( Y y , E e , , E e ) 1 1 j j = Y y = 1. Construct a factor for each conditional probability. P ( X | pa ( X )) f ( X , pa ( X )) i i i i i n ∑ ∑∏ = = =   P ( Y , E e , , E e ) ( f ) = = 1 1 j j i E e ,  , E e 1 1 j j = Z Z i 1 k 1 2. For each factor, assign the observed variables E to their observed values. 3. Given an elimination ordering, decompose sum of products Sum out all variables Z i not involved in the query (one a time) 4. • Multiply factors containing Z i Then marginalize out Z i from the product • 5. Multiply the remaining factors (which only involve Y ) 6. Normalize by dividing the resulting factor f(Y) by ∑ f ( Y ) y

  9. Step 1: Construct a factor for each cond. probability 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) 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) 9

  10. Step 2: assign to observed variables their observed values. 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) 10

  11. Step 3: Decompose sum of products Compute P(G | H=h 1 ) . Previous state: 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) 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) 11

  12. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: 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: perform product and sum out A in 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 10 (B) does not depend on C, E, or I, so we can push it outside of those sums. 12

  13. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: 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: perform product and sum out C in 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 11 (B,D,E) 13

  14. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: A,C, E ,I,B,D,F Previous state: P(G,H=h 1 ) = 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 11 (B,D,E) Eliminate E: perform product and sum out E in P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) ∑ F ∑ D f 5 (F, D) ∑ B f 10 (B) f 12 (B,D,F,G) ∑ I f 8 (I,G) 14

  15. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: A,C,E, I ,B,D,F Previous state: P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) ∑ F ∑ D f 5 (F, D) ∑ B f 10 (B) f 12 (B,D,F,G) ∑ I f 8 (I,G) Eliminate I: perform product and sum out I in P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) f 13 (G) ∑ F ∑ D f 5 (F, D) ∑ B f 10 (B) f 12 (B,D,F,G) 15

  16. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: A,C,E,I, B ,D,F Previous state: P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) f 13 (G) ∑ F ∑ D f 5 (F, D) ∑ B f 10 (B) f 12 (B,D,F,G) Eliminate B: perform product and sum out B in P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) f 13 (G) ∑ F ∑ D f 5 (F, D) f 14 (D,F,G) 16

  17. Step 4: sum out non query variables (one at a time) Compute P(G | H=h 1 ) . Elimination order: A,C,E,I,B, D ,F Previous state: P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) f 13 (G) ∑ F ∑ D f 5 (F, D) f 14 (D,F,G) Eliminate D: perform product and sum out D in P(G,H=h 1 ) = P(G,H=h 1 ) = f 9 (G) f 13 (G) ∑ F f 15 (F,G) Multiply remaining factors (all in G): P(G,H=h 1 ) = f 17 (G) 17

Recommend


More recommend