cse 473 artificial intelligence
play

CSE 473: Artificial Intelligence Bayesian Networks: Inference Hanna - PowerPoint PPT Presentation

CSE 473: Artificial Intelligence Bayesian Networks: Inference Hanna Hajishirzi Many slides over the course adapted from either Luke Zettlemoyer, Pieter Abbeel, Dan Klein, Stuart Russell or Andrew Moore 1 Outline Bayesian Networks


  1. CSE 473: Artificial Intelligence Bayesian Networks: Inference Hanna Hajishirzi Many slides over the course adapted from either Luke Zettlemoyer, Pieter Abbeel, Dan Klein, Stuart Russell or Andrew Moore 1

  2. Outline § Bayesian Networks Inference § Exact Inference: Variable Elimination § Approximate Inference: Sampling

  3. Bayes Net Representation 3

  4. 4

  5. Reachability (D-Separation) ! Question: Are X and Y Active Triples Inactive Triples conditionally independent (dependent) (Independent) given evidence vars {Z}? ! Yes, if X and Y “separated” by Z ! Look for active paths from X to Y ! No active paths = independence! ! A path is active if each triple is active: ! Causal chain A → B → C where B is unobserved (either direction) ! Common cause A ← B → C where B is unobserved ! Common effect (aka v-structure) A → B ← C where B or one of its descendents is observed ! All it takes to block a path is a single inactive segment ! 5

  6. Bayes Net Joint Distribution B# P(B)# E# P(E)# B # E # +b# 0.001# +e# 0.002# Qb# 0.999# Qe# 0.998# A # A# J# P(J|A)# A# M# P(M|A)# B# E# A# P(A|B,E)# +a# +j# 0.9# +a# +m# 0.7# +b# +e# +a# 0.95# +a# Qj# 0.1# +a# Qm# 0.3# J # M # +b# +e# Qa# 0.05# Qa# +j# 0.05# Qa# +m# 0.01# +b# Qe# +a# 0.94# Qa# Qj# 0.95# Qa# Qm# 0.99# +b# Qe# Qa# 0.06# Qb# +e# +a# 0.29# Qb# +e# Qa# 0.71# Qb# Qe# +a# 0.001# Qb# Qe# Qa# 0.999# 6

  7. Bayes Net Joint Distribution B# P(B)# E# P(E)# B # E # +b# 0.001# +e# 0.002# Qb# 0.999# Qe# 0.998# A # A# J# P(J|A)# A# M# P(M|A)# B# E# A# P(A|B,E)# +a# +j# 0.9# +a# +m# 0.7# +b# +e# +a# 0.95# +a# Qj# 0.1# +a# Qm# 0.3# J # M # +b# +e# Qa# 0.05# Qa# +j# 0.05# Qa# +m# 0.01# +b# Qe# +a# 0.94# Qa# Qj# 0.95# Qa# Qm# 0.99# +b# Qe# Qa# 0.06# Qb# +e# +a# 0.29# Qb# +e# Qa# 0.71# Qb# Qe# +a# 0.001# Qb# Qe# Qa# 0.999# 7

  8. Probabilistic Inference § Probabilistic inference: compute a desired probability from other known probabilities (e.g. conditional from joint) § We generally compute conditional probabilities § P(on time | no reported accidents) = 0.90 § These represent the agent ’ s beliefs given the evidence § Probabilities change with new evidence: § P(on time | no accidents, 5 a.m.) = 0.95 § P(on time | no accidents, 5 a.m., raining) = 0.80 § Observing new evidence causes beliefs to be updated

  9. Inference ! Inference:#calcula)ng#some# ! Examples:# useful#quan)ty#from#a#joint# ! Posterior#probability# probability#distribu)on# ! Most#likely#explana)on:# 9

  10. Inference by Enumeration § General case: § Evidence variables: § Query* variable: All variables § Hidden variables: § We want: § First, select the entries consistent with the evidence § Second, sum out H to get joint of Query and evidence: § Finally, normalize the remaining entries to conditionalize § Obvious problems: § Worst-case time complexity O(d n ) § Space complexity O(d n ) to store the joint distribution

  11. Inference in BN by Enumeration ! Given#unlimited#)me,#inference#in#BNs#is#easy# B # E # ! Reminder#of#inference#by#enumera)on#by#example:# P ( B | + j, + m ) ∝ B P ( B, + j, + m ) A # X = P ( B, e, a, + j, + m ) J # M # e,a X = P ( B ) P ( e ) P ( a | B, e ) P (+ j | a ) P (+ m | a ) e,a = P ( B ) P (+ e ) P (+ a | B, + e ) P (+ j | + a ) P (+ m | + a ) + P ( B ) P (+ e ) P ( − a | B, + e ) P (+ j | − a ) P (+ m | − a ) P ( B ) P ( − e ) P (+ a | B, − e ) P (+ j | + a ) P (+ m | + a ) + P ( B ) P ( − e ) P ( − a | B, − e ) P (+ j | − a ) P (+ m | − a ) 11

  12. Inference by Enumerataion P ( Antilock | observed variables ) = ? 12

  13. Variable Elimination § Why is inference by enumeration so slow? § You join up the whole joint distribution before you sum out the hidden variables § You end up repeating a lot of work! § Idea: interleave joining and marginalizing! § Called “ Variable Elimination ” § Still NP-hard, but usually much faster than inference by enumeration § We ’ ll need some new notation to define VE

  14. Review T W P § Joint distribution: P(X,Y) hot sun 0.4 § Entries P(x,y) for all x, y § Sums to 1 hot rain 0.1 cold sun 0.2 cold rain 0.3 § Selected joint: P(x,Y) T W P § A slice of the joint distribution § Entries P(x,y) for fixed x, all y cold sun 0.2 § Sums to P(x) cold rain 0.3

  15. Review § Family of conditionals: P(X |Y) T W P § Multiple conditionals hot sun 0.8 § Entries P(x | y) for all x, y § Sums to |Y| hot rain 0.2 cold sun 0.4 cold rain 0.6 § Single conditional: P(Y | x) T W P § Entries P(y | x) for fixed x, all cold sun 0.4 y § Sums to 1 cold rain 0.6

  16. Review § Specified family: P(y | X) T W P § Entries P(y | x) for fixed y, hot rain 0.2 but for all x § Sums to … who knows! cold rain 0.6 § In general, when we write P(Y 1 … Y N | X 1 … X M ) § It is a “ factor, ” a multi-dimensional array § Its values are all P(y 1 … y N | x 1 … x M ) § Any assigned X or Y is a dimension missing (selected) from the array

  17. Inference § Inference is expensive with enumeration § Variable elimination: § Interleave joining and marginalization: Store initial results and then join with the rest

  18. Example: Traffic Domain § Random +r ¡ 0.1 ¡ R -­‑r ¡ 0.9 ¡ Variables § R: Raining T +r ¡ +t ¡ 0.8 ¡ § T: Traffic +r ¡ -­‑t ¡ 0.2 ¡ § L: Late for class! -­‑r ¡ +t ¡ 0.1 ¡ L -­‑r ¡ -­‑t ¡ 0.9 ¡ § First query: P(L) +t ¡ +l ¡ 0.3 ¡ +t ¡ -­‑l ¡ 0.7 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑t ¡ -­‑l ¡ 0.9 ¡

  19. Variable Elimination Outline § Maintain a set of tables called factors § Initial factors are local CPTs (one per node) +r ¡ +t ¡ 0.8 ¡ +t ¡ +l ¡ 0.3 ¡ +r ¡ 0.1 ¡ +r ¡ -­‑t ¡ 0.2 ¡ +t ¡ -­‑l ¡ 0.7 ¡ -­‑r ¡ 0.9 ¡ -­‑r ¡ +t ¡ 0.1 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑r ¡ -­‑t ¡ 0.9 ¡ -­‑t ¡ -­‑l ¡ 0.9 ¡ § Any known values are selected § E.g. if we know , the initial factors are +r ¡ +t ¡ 0.8 ¡ +r ¡ 0.1 ¡ +t ¡ +l ¡ 0.3 ¡ +r ¡ -­‑t ¡ 0.2 ¡ -­‑r ¡ 0.9 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑r ¡ +t ¡ 0.1 ¡ -­‑r ¡ -­‑t ¡ 0.9 ¡ § VE: Alternately join factors and eliminate variables

  20. Operation 1: Join Factors § First basic operation: joining factors § Combining factors: § Just like a database join § Get all factors over the joining variable § Build a new factor over the union of the variables involved § Example: Join on R R,T R +r ¡ +t ¡ 0.8 ¡ +r ¡ +t ¡ 0.08 ¡ +r ¡ 0.1 ¡ +r ¡ -­‑t ¡ 0.2 ¡ +r ¡ -­‑t ¡ 0.02 ¡ -­‑r ¡ 0.9 ¡ T -­‑r ¡ +t ¡ 0.1 ¡ -­‑r ¡ +t ¡ 0.09 ¡ -­‑r ¡ -­‑t ¡ 0.9 ¡ -­‑r ¡ -­‑t ¡ 0.81 ¡ § Computation for each entry: pointwise products

  21. Example: Multiple Joins +r ¡ 0.1 ¡ Join R R -­‑r ¡ 0.9 ¡ R, T +r ¡ +t ¡ 0.08 ¡ +r ¡ -­‑t ¡ 0.02 ¡ -­‑r ¡ +t ¡ 0.09 ¡ T +r ¡ +t ¡ 0.8 ¡ -­‑r ¡ -­‑t ¡ 0.81 ¡ +r ¡ -­‑t ¡ 0.2 ¡ L -­‑r ¡ +t ¡ 0.1 ¡ -­‑r ¡ -­‑t ¡ 0.9 ¡ L +t ¡ +l ¡ 0.3 ¡ +t ¡ +l ¡ 0.3 ¡ +t ¡ -­‑l ¡ 0.7 ¡ +t ¡ -­‑l ¡ 0.7 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑t ¡ -­‑l ¡ 0.9 ¡ -­‑t ¡ -­‑l ¡ 0.9 ¡

  22. Example: Multiple Joins R, T, L +r ¡ +t ¡ 0.08 ¡ +r ¡ -­‑t ¡ 0.02 ¡ +r ¡ +t ¡ +l ¡ Join T -­‑r ¡ +t ¡ 0.09 ¡ R, T 0.024 ¡ -­‑r ¡ -­‑t ¡ 0.81 ¡ +r ¡ +t ¡ -­‑l ¡ 0.056 ¡ +r ¡ -­‑t ¡ +l ¡ 0.002 ¡ L +r ¡ -­‑t ¡ -­‑l ¡ 0.018 ¡ +t ¡ +l ¡ 0.3 ¡ -­‑r ¡ +t ¡ +l ¡ 0.027 ¡ +t ¡ -­‑l ¡ 0.7 ¡ -­‑r ¡ +t ¡ -­‑l ¡ 0.063 ¡ -­‑t ¡ +l ¡ 0.1 ¡ -­‑r ¡ -­‑t ¡ +l ¡ 0.081 ¡ -­‑t ¡ -­‑l ¡ 0.9 ¡ -­‑r ¡ -­‑t ¡ -­‑l ¡ 0.729 ¡

  23. Operation 2: Eliminate § Second basic operation: marginalization § Take a factor and sum out a variable § Shrinks a factor to a smaller one § A projection operation § Example: +r ¡ +t ¡ 0.08 ¡ +t ¡ 0.17 ¡ +r ¡ -­‑t ¡ 0.02 ¡ -­‑t ¡ 0.83 ¡ -­‑r ¡ +t ¡ 0.09 ¡ -­‑r ¡ -­‑t ¡ 0.81 ¡

  24. Multiple Elimination R, T, L T, L L Sum Sum +r ¡ +t ¡ +l ¡ 0.024 ¡ out T out R +r ¡ +t ¡ -­‑l ¡ 0.056 ¡ +r ¡ -­‑t ¡ +l ¡ +l ¡ 0.134 ¡ 0.051 ¡ +t ¡ +l ¡ 0.002 ¡ -­‑l ¡ 0.886 ¡ +r ¡ -­‑t ¡ -­‑l ¡ 0.119 ¡ +t ¡ -­‑l ¡ 0.018 ¡ -­‑r ¡ +t ¡ +l ¡ 0.083 ¡ -­‑t ¡ +l ¡ 0.027 ¡ -­‑r ¡ +t ¡ -­‑l ¡ 0.747 ¡ -­‑t ¡ -­‑l ¡ 0.063 ¡ -­‑r ¡ -­‑t ¡ +l ¡ 0.081 ¡ -­‑r ¡ -­‑t ¡ -­‑l ¡ 0.729 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend