inf er ence in bayesia n net wor k s
play

Inf er ence in Bayesia n net wor k s Cha pt er 14.4 5 - PowerPoint PPT Presentation

Inf er ence in Bayesia n net wor k s Cha pt er 14.4 5 Extracted from: http://aima.eecs.berkeley.edu/slides-pdf/chapter14b.pdf Chapter 14.4 5 1 Outline Exact inference by enumeration Exact inference by variable elimination


  1. Inf er ence in Bayesia n net wor k s Cha pt er 14.4 – 5 Extracted from: http://aima.eecs.berkeley.edu/slides-pdf/chapter14b.pdf Chapter 14.4 – 5 1

  2. Outline ♦ Exact inference by enumeration ♦ Exact inference by variable elimination Chapter 14.4 – 5 2

  3. Infer en ce tasks Simple queries: compute posterior marginal P ( X i | E = e ) e.g., P ( N oGas | Gauge = empty, Lights = on, Starts = f alse ) Conjunctive queries: P ( X i , X j | E = e ) = P ( X i | E = e ) P ( X j | X i , E = e ) Optimal decisions: decision netw orks include utility information; probabilistic inference required for P ( outcome | action, evidence ) Value of information: which evidence to seek next? Sensitivity analysis: which probability values are most critical? Explanation: why do I need a new starter motor? Chapter 14.4 – 5 3

  4. Infer en ce by enum era tion Slightly intelligent w ay to sum out variables from the joint without actually constructing its explicit representation Simple query on the burglary network: P ( B | j , m ) B E = P ( B, j , m ) / P ( j , m ) A = α P ( B, j , m ) = α Σ e Σ a P ( B, e, a, j , m ) J M Rewrite full joint entries using product of CPT entries: P ( B | j , m ) = α Σ e Σ a P ( B ) P ( e ) P ( a | B, e ) P ( j | a ) P ( m | a ) = α P ( B ) Σ e P ( e ) Σ a P ( a | B, e ) P ( j | a ) P ( m | a ) Recursive depth-first enumeration: O ( n ) space, O ( d n ) time Chapter 14.4 – 5 4

  5. Enum eration algorithm fu n ct ion En u mer at io n -Ask ( X , e , bn ) ret urn s a distribution over X in p u t s : X , the query variable e , observed values for variables E bn , a Bayesian network with variables { X } ∪ E ∪ Y ) ← a distribution over X , initially empty Q ( X for each value x i of X d o extend e with value x i for X Q ( x i ) ← En u mer at e-Al l ( V a r s [ bn ], e ) ret urn No r ma l ize ( Q ( X ) ) fu n ct ion En u mer at e-Al l ( vars , e ) ret urn s a real number if Empt y? ( vars ) t h en ret urn 1.0 Y ← F ir st ( vars ) if Y has value y in e t h en ret u rn P ( y | P a ( Y )) × En u mer at e-Al l ( Rest ( vars ), e ) y P ( y | P a ( Y )) × En u mer at e-Al l ( Rest ( vars ), e y ) P else ret u rn where e y is e extended with Y = y Chapter 14.4 – 5 5

  6. Evaluation tree P(b) .001 P(e) P( e) .002 .998 P(a|b,e) P( a|b,e) P(a|b, e) P( a|b, e) .95 .05 .94 .06 P(j|a) P(j| a) P(j|a) P(j| a) .90 .05 .90 .05 P(m|a) P(m| a) P(m|a) P(m| a) .70 .01 .70 .01 Enumeration is inefficient: repeated computation e.g., computes P ( j | a ) P ( m | a ) for each value of e Chapter 14.4 – 5 6

  7. Infer en ce by variable elim ination Variable elimination: carry out summations right-to-left, storing intermediate results (factors) to avoid recomputation P ( B | j , m ) = α P ( B ) Σ e P ( e ) Σ a P ( a | B, e ) P ( j | a ) P ( m | a ) | {z } | {z } | {z } | {z } | {z } B E A J M = α P ( B ) Σ e P ( e ) Σ a P ( a | B, e ) P ( j | a ) f M ( a ) = α P ( B ) Σ e P ( e ) Σ a P ( a | B, e ) f J ( a ) f M ( a ) = α P ( B ) Σ e P ( e ) Σ a f A ( a, b, e ) f J ( a ) f M ( a ) = α P ( B ) Σ e P ( e ) f A ¯ J M ( b, e ) (sum out A ) = α P ( B ) f E ¯ J M ( b ) (sum out E ) ¯ A = α f B ( b ) × f E ¯ J M ( b ) ¯ A Chapter 14.4 – 5 7

  8. Variable elim inat ion: B asic op erations Summing out a variable from a product of factors: move any constant factors outside the summation add up submatrices in pointwise product of remaining factors Σ f × · · · × f = f × · · · × f Σ × f = f 1 × · · · × f i × f X × · · · f ¯ x 1 1 i +1 k i x k assuming f 1 , . . . , f i do not depend on X Pointwise product of factors f 1 and f 2 : f 1 ( x 1 , . . . , x j , y 1 , . . . , y k ) × f 2 ( y 1 , . . . , y k , z 1 , . . . , z l ) = f ( x 1 , . . . , x j , y 1 , . . . , y k , z 1 , . . . , z l ) E.g., f 1 ( a, b ) × f 2 ( b, c ) = f ( a, b, c ) Chapter 14.4 – 5 8

  9. Variable elim ination algorithm fu n ct ion El imin at io n -Ask ( X , e , bn ) ret urn s a distribution over X in p u t s : X , the query variable e , evidence specified as an event bn , a belief network specifying joint distribution P ( X 1 , . . . , X n ) ← ← [ ] ; vars Rev er se ( V a r s [ bn ]) factors for each var in vars d o ← e ) | factors ] [ Ma k e-Fact o r ( var factors , ← Su m-Out ( var , if var is a hidden variable t h en factors factors ) ret urn No r ma l ize ( P o in t wise-P r o d u ct ( factors )) Chapter 14.4 – 5 9

  10. Irrelevant variables Consider the query P ( J ohnCalls | Burglary = true ) B E | b ) = α P ( b ) X P ( a | b, e ) P ( J | a ) X P ( m | a ) P ( J X P ( e ) A e a m J M Sum over m is identically 1; M is irrelevant to the query Thm 1: Y is irrelevant unless Y ∈ Ancestors ( { X } ∪ E ) { Burglary } , and Here, X = J ohnCalls , E = Ancestors ( { X } ∪ E ) = { Alarm, Earthquake } so M aryCalls is irrelevant (Compare this to backw ard chaining from the query in Horn clause KBs) Chapter 14.4 – 5 10

  11. Irrelevant variables contd. Defn: moral graph of Bayes net: marry all parents and drop arrows Defn: A is m-separated from B by C iff separated by C in the moral graph Thm 2: Y is irrelevant if m-separated from X by E B E For P ( J ohnCalls | Alarm = true ), both A Burglary and Earthquake are irrelevant J M Chapter 14.4 – 5 11

  12. C om plexity of exact infer ence Singly connected networks (or polytrees): – any tw o nodes are connected by at most one (undirected) path – time and space cost of variable elimination are O ( d k n ) Multiply connected networks: ⇒ NP-hard – can reduce 3SAT to exact inference – equivalent to counting 3SAT models ⇒ #P-complete 0.5 0.5 0.5 0.5 A B C D 1. A v B v C 1 2 3 2. C v D v A 3. B v C v D AND Chapter 14.4 – 5 12

  13. Sum m ary Exact inference by variable elimination: – polytime on polytrees, NP-hard on general graphs – space = time, very sensitive to topolog Chapter 14.4 – 5 13

Recommend


More recommend