inference in b elief net w orks chapter 15 3 4 new c aima
play

Inference in b elief net w orks Chapter 15.3{4 + new c - PowerPoint PPT Presentation

Inference in b elief net w orks Chapter 15.3{4 + new c AIMA Slides Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 1 Outline } Exact inference b y enumerati on } Exact inference b y va riable


  1. Inference in b elief net w orks Chapter 15.3{4 + new c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 1

  2. Outline } Exact inference b y enumerati on } Exact inference b y va riable elimina tion } App ro ximate inferenc e b y sto chastic simulation } App ro ximate inferenc e b y Ma rk ov chain Monte Ca rlo c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 2

  3. Inference tasks ( X j E = e ) Simple queries : compute p osterio r ma rginal P i ( N oGas j Gaug = = = se ) e.g., P e empty ; Lig hts on; S tar ts f al ( X j E = ) = P ( X j E = e ) P ( X j X = e ) Conjunctive queries : P ; X e ; E i j i j i Optimal decisions : decision net w o rks include utilit y info rmation; ( outcome j action; idence ) p robabili stic inference required fo r P ev V alue of info rmation : which evidence to seek next? Sensitivit y analysis : which p robabilit y values a re most critical? Explanation : why do I need a new sta rter moto r? c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 3

  4. Inference b y en umeration Slightly intellige nt w a y to sum out va riables from the joint without ac- tually constructin g its explicit rep resentation Simple query on the burgla ry net w o rk: P ( B = = ue ) j J tr ue; M tr = P ( B = = ue ) =P ( J = = ue ) ; J tr ue; M tr tr ue; M tr = � P ( B = = ue ) ; J tr ue; M tr � � � = P ( B = = ue ) ; e; a; J tr ue; M tr e a Rewrite full joint entries using p ro duct of CPT entries: ( B = = = ue ) P tr ue j J tr ue; M tr � � � = ( B = ue ) P ( e ) P ( a j B = e ) P ( J = ue j a ) P ( M = ue j a ) P tr tr ue; tr tr e a ue ) � ( e ) � = ( B = ( a j B = e ) P ( J = ue j a ) P ( M = ue j a ) �P tr P P tr ue; tr tr e a c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 4

  5. En umeration algorithm n ( n ) ( d ) Exhaustive depth-�rst enumeration: space, time O O tionAsk ( X , e , bn ) a distribution o v er Enumera X returns inputs : X , the query v ariable , evidence sp eci�ed as an ev en t e bn , a b elief net w ork sp ecifying join t distribution P ( X ) ; : : : ; X 1 n Q ( X ) a distribution o v er X v alue of x X for eac h do i extend with v alue for x X e i ( x ) ( V ars [ bn ], e ) Enumera teAll Q i ( Q ( X )) Normalize return ( vars , e ) a real n um b er Enumera teAll returns ( vars ) 1.0 Empty? if then return else do First ( vars ) Y has v alue in Y y if e ( y a ( Y )) ( Rest ( vars ), e ) Enumera teAll P P j � then return ( y a ( Y )) ( Rest ( vars ), e ) Enumera teAll P P P j � else return y y where is extended with = Y y e e y c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 5

  6. Inference b y v ariable elimination Enumeratio n is ine�cient: rep eated computation ( J = ue j a ) P ( M = ue j a ) e.g., computes P tr tr fo r each value of e V a riable elimina tion : ca rry out summations right-to-left, sto ring intermedia te results (facto rs ) to avoid recomputation P ( B = = ue ) j J tr ue; M tr � � = ( B ) ( e ) P ( a j B e ) ( J = ue j a ) ( M = ue j a ) � P P ; P tr P tr e a | {z } | {z } | {z } | {z } | {z } B E A J M ) � ( e ) � = � P ( B ( a j B e ) P ( J = ue j a ) f ( a ) P P ; tr e a M ) � ( e ) � = � P ( B ( a j B e ) f ( a ) f ( a ) P P ; e a J M ) � ( e ) � = � P ( B ( a; e ) f ( a ) f ( a ) P f b; e a A J M ) � = � P ( B ( e ) f ( b; e ) P (sum out A ) � e A J M = � P ( B ) f ( b ) (sum out E ) � � E AJ M = ( b ) ( b ) � �f f � � B E AJ M c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 6

  7. V ariable elimination: Basic op erations P oint wise p ro duct of facto rs f and f : 1 2 ( x ) ( y ) f ; : : : ; x ; y ; : : : ; y � f ; : : : ; y ; z ; : : : ; z 1 1 1 2 1 1 j k k l ( x ) = f ; : : : ; x ; y ; : : : ; y ; z ; : : : ; z 1 1 1 j k l ( a; b ) � ( b; c ) = ( a; c ) E.g., f f f b; 1 2 Summing out a va riable from a p ro duct of facto rs: move any constant facto rs outside the summation: � � = = f � � � � � f f � � � � � f f � � � � � f f � � � � � f � f � 1 1 i +1 1 x k i x k i X assuming do not dep end on f ; : : : ; f X 1 i c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 7

  8. V ariable elimination algorithm ( X , e , bn ) a distribution o v er Elimina tionAsk X function returns inputs : X , the query v ariable , evidence sp eci�ed as an ev en t e bn , a b elief net w ork sp ecifying join t distribution P ( X ) ; : : : ; X 1 n observ ed p oin t distribution for X X if 2 e then return [ ]; ( V ars [ bn ]) factors vars Reverse var vars for eac h in do [ MakeF ( var ) j factors ] factors a ctor ; e is a hidden v ariable ( var , factors ) var factors SumOut if then ( PointwisePr ( factors )) Normalize oduct return c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 8

  9. Complexit y of exact inference Singly connected net w o rks (o r p olytrees ): { any t w o no des a re connected b y at most one (undirec ted ) path k ( d n ) { time and space cost of va riable eliminati on a re O Multiply connected net w o rks: { can reduce 3SA T to exact inference ) NP-ha rd { equivalent to 3SA T mo dels ) #P-complete c ounting 0.5 0.5 0.5 0.5 A B C D 1. A v B v C 2. C v D v ~A 1 2 3 3. B v C v ~D AND c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 9

  10. Inference b y sto c hastic sim ulation Basic idea: 1) Dra w N samples from a sampling distributi on S ^ 2) Compute an app ro ximate p osterio r p robabili t y P 3) Sho w this converges to the true p robabili t y P Outline: { Sampling from an empt y net w o rk { Rejection sampling: reject samples disagreeing with evidence { Lik eliho o d w eighting: use evidence to w eight samples { MCMC: sample from a sto chastic p ro cess whose stationa ry distributi on is the true p osterio r c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 10

  11. Sampling from an empt y net w ork PriorSample ( bn ) an ev en t sampled from P ( X ) sp eci�ed b y ; : : : ; X bn function returns 1 n an ev en t with elemen ts n x = 1 i n for to do a random sample from P ( X ents ( X )) x P ar j i i i return x P(C) = .5 Cloudy P ( C ) = h 0 : 5 ; 0 : 5 i l oudy ! sample tr ue C P(S) C P(R) Rain Sprinkler P ( S j C ) = h 0 : 1 ; 0 : 9 i pr ink l er l oudy T .10 T .80 F .50 F .20 ! sample f al se Wet Grass P ( R ) = h 0 : 8 ; 0 : 2 i ain j C l oudy S R P(W) sample ! tr ue T T .99 P ( W ain ) = h 0 : 9 ; 0 : 1 i ass j: S etGr pr ink l er ; R T F .90 F T .90 sample ! tr ue F F .00 c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 11

  12. Sampling from an empt y net w ork con td. Probabili t y that PriorSample generates a pa rticula r event n � ( x ) = ( x ents ( X )) = ( x ) S : : : x P j P ar P : : : x 1 1 P S n i i n = 1 i i.e., the true p rio r p robabilit y ( Y = y ) = Let N b e the numb er of samples generated fo r which Y y , P S fo r any set of va riables Y . ^ ( Y = y ) = ( Y = ) = Then P N y N and P S ^ � lim ( Y = ) = ( Y = = h ) P y S y ; H h P S N !1 � = ( Y = = h ) P y ; H h = ( Y = ) P y That is, estimates derived from PriorSample a re consistent c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 12

  13. Rejection sampling ^ P ( X ) j e estimated from samples agreeing with e RejectionSampling ( X , e , bn , N ) an appro ximation to ( X ) P j e function returns N [ X ] a v ector of coun ts o v er X , initially zero = 1 to j N for do ( bn ) PriorSample x is consisten t with if x e then N [ x ] N [ x ]+1 where is the v alue of in x X x ( N [ X ]) Normalize return ( R = ue ) E.g., estimate P ain j S pr ink l er tr using 100 samples = 27 samples have S pr ink l er tr ue = = Of these, 8 have R ain tr ue and 19 have R ain f al se . ^ P ( R = ue ) = ( h 8 ; 19 i ) = h 0 : 296 ; 0 : 704 i ain j S pr ink l er tr Normalize Simila r to a basic real-w o rld empirical estimation p ro cedure c AIMA Slides � Stuart Russell and P eter Norvig, 1998 Chapter 15.3{4 + new 13

Recommend


More recommend