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
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Inf er ence in Bayesia n net wor k s

Cha pt er 14.4–5

Chapter 14.4–5 1

Extracted from: http://aima.eecs.berkeley.edu/slides-pdf/chapter14b.pdf

slide-2
SLIDE 2

Outline

♦ Exact inference by enumeration ♦ Exact inference by variable elimination

Chapter 14.4–5 2

slide-3
SLIDE 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

  • rks 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

slide-4
SLIDE 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:

B E

Chapter 14.4–5 4

J A M

P(B|j , m) = P(B, j , m)/ P (j , m) = αP(B, j , m) = α Σe Σa P(B, e, a, 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(dn) time

slide-5
SLIDE 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 Q(X ) ← a distribution over X, initially empty for each value xi of X d o extend e with value xi for X Q(xi ) ← 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) else ret u rn

P

y P (y | P a(Y )) × En u mer at e-Al l (Rest (vars),

ey ) where ey is e extended with Y = y

Chapter 14.4–5 5

slide-6
SLIDE 6

Evaluation tree

P(j|a) .90 P(m|a) .70 P(m| a) .01 P(j| a) .05 P(j|a) .90 P(m|a) .70 P(m| a) .01 P(j| a) .05 P(b) .001 P(e) .002 P( e) .998 P(a|b,e) .95 P( a|b, e) .06 P( a|b,e) .05 P(a|b, e) .94

Enumeration is inefficient: repeated computation e.g., computes P (j |a)P (m|a) for each value of e

Chapter 14.4–5 6

slide-7
SLIDE 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)

Chapter 14.4–5 7

| {z } | {z } | {z } | {z } | {z }

B E A J M

= αP(B)ΣeP (e)ΣaP(a|B, e)P (j |a)f M (a) = αP(B)ΣeP (e)ΣaP(a|B, e)f J (a)f M (a) = αP(B)ΣeP (e)Σaf A(a, b, e)f J (a)f M (a) = αP(B)ΣeP (e)f A

¯J M (b, e) (sum out A)

= αP(B)f E

¯A ¯J M (b) (sum out E)

= αf B (b) × f E

¯A ¯J M (b)

slide-8
SLIDE 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

Chapter 14.4–5 8

Σ f × ·

· · × f = f × · · · × f Σ

x 1 k 1 i x i+1 k

f × · · · × f = f 1 × · · · × f i × f X

¯

assuming f 1, . . . , f i do not depend on X Pointwise product of factors f 1 and f 2: f 1(x1, . . . , xj , y1, . . . , yk) × f 2(y1, . . . , yk, z1, . . . , zl) = f (x1, . . . , xj , y1, . . . , yk, z1, . . . , zl) E.g., f 1(a, b) × f 2(b, c) = f (a, b, c)

slide-9
SLIDE 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) factors ← [ ]; vars ← Rev er se(V a r s[bn]) for each var in vars d o factors ← [Ma k e-Fact o r (var , e)|factors] if var is a hidden variable t h en factors ← Su m-Out (var, 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

slide-10
SLIDE 10

Irrelevant variables

Consider the query P (J ohnCalls|Burglary = true)

B

Chapter 14.4–5 10

E J A M

P (J |b) = αP (b)

X P (e) X P (a|b, e)P (J |a) X P (m|a)

e a m

Sum over m is identically 1; M is irrelevant to the query Thm 1: Y is irrelevant unless Y ∈ Ancestors({ X } ∪ E) Here, X = J ohnCalls, E = { Burglary} , and Ancestors({ X } ∪ E) = { Alarm, Earthquake} so M aryCalls is irrelevant (Compare this to backw ard chaining from the query in Horn clause KBs)

slide-11
SLIDE 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

Chapter 14.4–5 11

J A M

For P (J ohnCalls|Alarm = true), both Burglary and Earthquake are irrelevant

slide-12
SLIDE 12

C om plexity of exact infer ence

Singly connected networks (or polytrees): – any tw

  • nodes are connected by at most one (undirected) path

– time and space cost of variable elimination are O(dkn) Multiply connected networks: – can reduce 3SAT to exact inference ⇒ NP-hard – equivalent to counting 3SAT models ⇒ #P-complete

0.5

A

Chapter 14.4–5 12

0.5

B

0.5

C

0.5

D 1 2 3 AND

  • 1. A v B v C
  • 2. C v D v

A

  • 3. B v C v

D

slide-13
SLIDE 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