Bayesian Networks Bayesian Networks Course: CS40022 Course: CS40022 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Kharagpur Indian Institute of Technology
Example Example � Burglar alarm at home Burglar alarm at home � � Fairly reliable at detecting a burglary Fairly reliable at detecting a burglary � � Responds at times to minor earthquakes Responds at times to minor earthquakes � � Two neighbors, on hearing alarm, calls police Two neighbors, on hearing alarm, calls police � � John always calls when he hears the John always calls when he hears the � alarm, but sometimes confuses the alarm, but sometimes confuses the telephone ringing with the alarm and calls telephone ringing with the alarm and calls then, too. then, too. � Mary likes loud music and sometimes Mary likes loud music and sometimes � misses the alarm altogether misses the alarm altogether CSE, IIT Kharagpur Kharagpur CSE, IIT
Belief Network Example Belief Network Example P(B) P(E) P(B) P(E) Burglary Earthquake 0.001 0.001 0.002 0.002 B E P(A) B E P(A) T T T T 0.95 0.95 Alarm T F 0.95 T F 0.95 F T 0.29 F T 0.29 F F 0.001 F F 0.001 A P(J) A P(J) T 0.90 A P(M) T 0.90 A P(M) JohnCalls MaryCalls F 0.05 T 0.70 F 0.05 T 0.70 F 0.01 F 0.01 CSE, IIT Kharagpur Kharagpur CSE, IIT
The joint probability distribution The joint probability distribution � A generic entry in the joint probability A generic entry in the joint probability � distribution P(x 1 , …, x x n ) is given by: distribution P(x 1 , …, n ) is given by: n ∏ = P ( x ,..., x ) P ( x | Parents ( X )) 1 n i i = i 1 CSE, IIT Kharagpur Kharagpur CSE, IIT
The joint probability distribution The joint probability distribution � Probability of the event that the alarm has Probability of the event that the alarm has � sounded but neither a burglary nor an sounded but neither a burglary nor an earthquake has occurred, and both Mary and earthquake has occurred, and both Mary and John call: John call: ∧ M ∧ A ∧ ¬ ¬ B ∧ ¬ ¬ E) P(J ∧ M ∧ A ∧ B ∧ E) P(J ¬ B ∧ ¬ ¬ E) = P(J | A) P(M | A) P(A | ¬ B ∧ E) = P(J | A) P(M | A) P(A | ¬ B) P( ¬ E) P( ¬ B) P( ¬ E) P( = 0.9 X 0.7 X 0.001 X 0.999 X 0.998 = 0.9 X 0.7 X 0.001 X 0.999 X 0.998 = 0.00062 = 0.00062 CSE, IIT Kharagpur Kharagpur CSE, IIT
Conditional independence Conditional independence P ( x ,..., x ) n 1 = P ( x | x ,..., x ) P ( x ,..., x ) − − n n 1 1 n 1 1 = P ( x | x ,..., x ) P ( x | x ,..., x ) − − − n n 1 1 n 1 n 2 1 ... P ( x | x ) P ( x ) 2 1 1 n ∏ = P ( x | x ,..., x ) − i i 1 1 = i 1 � The belief network represents conditional The belief network represents conditional � independence: independence: = P ( X | X ,..., X ) P ( X | Parents ( X )) i i i i 1 CSE, IIT Kharagpur Kharagpur CSE, IIT
Incremental Network Construction Incremental Network Construction 1. Choose the set of relevant variables Choose the set of relevant variables X X i that 1. i that describe the domain describe the domain 2. Choose an ordering for the variables ( Choose an ordering for the variables ( very very 2. important step ) ) important step 3. While there are variables left: While there are variables left: 3. a) Pick a variable X and add a node for it Pick a variable X and add a node for it a) b) Set Parents(X) to some minimal set of Set Parents(X) to some minimal set of b) existing nodes such that the conditional existing nodes such that the conditional independence property is satisfied independence property is satisfied c) Define the conditional Define the conditional prob prob table for X table for X c) CSE, IIT Kharagpur Kharagpur CSE, IIT
Conditional Independence Relations Conditional Independence Relations If every undirected path from a node in X to a If every undirected path from a node in X to a � � node in Y is d- -separated by a given set of separated by a given set of node in Y is d evidence nodes E, then X and Y are evidence nodes E, then X and Y are conditionally independent given E. conditionally independent given E. A set of nodes E d d- -separates separates two sets of two sets of A set of nodes E � � nodes X and Y if every undirected path from a nodes X and Y if every undirected path from a node in X to a node in Y is blocked blocked given E. given E. node in X to a node in Y is CSE, IIT Kharagpur Kharagpur CSE, IIT
Conditional Independence Relations Conditional Independence Relations � A path is blocked given a set of nodes E if A path is blocked given a set of nodes E if � there is a node Z on the path for which one of there is a node Z on the path for which one of three conditions holds: three conditions holds: 1. Z is in E and Z has one arrow on the path Z is in E and Z has one arrow on the path 1. leading in and one arrow out leading in and one arrow out 2. Z is in E and Z has both path arrows Z is in E and Z has both path arrows 2. leading out leading out 3. Neither Z nor any descendant of Z is in E, Neither Z nor any descendant of Z is in E, 3. and both path arrows lead in to Z and both path arrows lead in to Z CSE, IIT Kharagpur Kharagpur CSE, IIT
Cond Independence in belief networks Independence in belief networks Cond Battery Petrol Ignition Radio Starts Whether there is petrol and whether the radio plays are independent given evidence about whether the ignition takes place Petrol and Radio are independent if it is known whether the battery works CSE, IIT Kharagpur Kharagpur CSE, IIT
Cond Independence in belief networks Independence in belief networks Cond Battery Petrol Ignition Radio Starts Petrol and Radio are independent given no evidence at all. But they are dependent given evidence about whether the car starts. If the car does not start, then the radio playing is increased evidence that we are out of petrol. CSE, IIT Kharagpur Kharagpur CSE, IIT
Inferences using belief networks Inferences using belief networks � Diagnostic inferences Diagnostic inferences (from effects to causes) (from effects to causes) � � Given that Given that JohnCalls JohnCalls, infer that , infer that � P(Burglary | JohnCalls JohnCalls) = 0.016 ) = 0.016 P(Burglary | � Causal inferences Causal inferences (from causes to effects) (from causes to effects) � � Given Burglary, infer that Given Burglary, infer that � P(JohnCalls JohnCalls | Burglary) = 0.86 and | Burglary) = 0.86 and P( P(MaryCalls MaryCalls | Burglary) = 0.67 | Burglary) = 0.67 P( CSE, IIT Kharagpur Kharagpur CSE, IIT
Inferences using belief networks Inferences using belief networks � Intercausal Intercausal inferences inferences (between causes of a common (between causes of a common � effect) effect) � Given Alarm, we have Given Alarm, we have � P(Burglary | Alarm) = 0.376. P(Burglary | Alarm) = 0.376. � If we add evidence that Earthquake is true, then If we add evidence that Earthquake is true, then � ∧ Earthquake) goes down to P(Burglary | Alarm ∧ Earthquake) goes down to P(Burglary | Alarm 0.003 0.003 � Mixed inferences Mixed inferences � � Setting the effect Setting the effect JohnCalls JohnCalls to true and the cause to true and the cause � ∧ JohnCalls ∧ Earthquake to false gives P(Alarm | JohnCalls Earthquake to false gives P(Alarm | ¬ Earthquake) ¬ Earthquake) = 0.003 = 0.003 CSE, IIT Kharagpur Kharagpur CSE, IIT
The four patterns The four patterns Q E Q E E Q E Q E Diagnostic Causal InterCausal Mixed CSE, IIT Kharagpur Kharagpur CSE, IIT
Answering queries Answering queries � We consider cases where the belief network We consider cases where the belief network � is a poly- -tree tree is a poly � There is at most one undirected path There is at most one undirected path � between any two nodes between any two nodes CSE, IIT Kharagpur Kharagpur CSE, IIT
Answering queries Answering queries + E X U 1 U m X − E X Z nj Z 1j Y 1 Y n CSE, IIT Kharagpur Kharagpur CSE, IIT
Answering queries Answering queries • U = U 1 … U m are parents of node X • Y = Y 1 … Y n are children of node X • X is the query variable • E is a set of evidence variables • The aim is to compute P(X | E) CSE, IIT Kharagpur Kharagpur CSE, IIT
Recommend
More recommend