1 / 64

Probabilistic Inference

Probabilistic Inference. Agenda. Conditional probability Independence Intro to Bayesian Networks. Remember: Probability Notation Leaves Values Implicit. P(A B) = P(A)+P(B)- P(A  B) means. P(A=a  B=b) = P(A=a) + P(B=b) P(A=a  B=b) For all a Val(A) and b Val(B).

royce
Télécharger la présentation

Probabilistic Inference

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Probabilistic Inference

  2. Agenda • Conditional probability • Independence • Intro to Bayesian Networks

  3. Remember: Probability Notation Leaves Values Implicit • P(AB) = P(A)+P(B)- P(AB) means • P(A=a  B=b) = P(A=a) + P(B=b) • P(A=a  B=b) • For all aVal(A) and bVal(B) A and B are random variables.A=a and B=b are events. Random variables indicate many possible combinations of events

  4. Conditional Probability • P(A,B) = P(A|B) P(B) = P(B|A) P(A)P(A|B) is the posterior probability of A given knowledge of B • Axiomatic definition: P(A|B) = P(A,B)/P(B)

  5. Conditional Probability • P(A|B) is the posterior probability of A given knowledge of B • “For each value of b: given that I know B=b, what do I believe about A?” • If a new piece of information C arrives, the agent’s new belief (if it obeys the rules of probability) should beP(A|B,C)

  6. Conditional Distributions P(Cavity|Toothache) = P(CavityToothache)/P(Toothache) = (0.108+0.012)/(0.108+0.012+0.016+0.064) = 0.6 Interpretation: After observing Toothache, the patient is no longer an “average” one, and the prior probability (0.2) of Cavity is no longer valid P(Cavity|Toothache) is calculated by keeping the ratios of the probabilities of the 4 cases of Toothache unchanged, and normalizing their sum to 1

  7. Updating the Belief State • The patient walks into the dentists door • Let D now observe evidence E: Toothache holds with probability 0.8 (e.g., “the patient says so”) • How should D update its belief state?

  8. Updating the Belief State • P(Toothache|E) = 0.8 • We want to compute P(CTP|E)= P(CP|T,E) P(T|E) • Since E is not directly related to the cavity or the probe catch, we consider that C and P are independent of E given T, hence:P(CP|T,E) = P(CP|T) • P(CTP|E)= P(CPT) P(T|E)/P(T)

  9. Updating the Belief State • P(Toothache|E) = 0.8 • We want to compute P(CTP|E)= P(CP|T,E) P(T|E) • Since E is not directly related to the cavity or the probe catch, we consider that C and P are independent of E given T, hence:P(CP|T,E) = P(CP|T) • P(CTP|E)= P(CPT) P(T|E)/P(T) These rows should be scaled to sum to 0.8 These rows should be scaled to sum to 0.2

  10. Updating the Belief State • P(Toothache|E) = 0.8 • We want to compute P(CTP|E)= P(CP|T,E) P(T|E) • Since E is not directly related to the cavity or the probe catch, we consider that C and P are independent of E given T, hence:P(CP|T,E) = P(CP|T) • P(CTP|E)= P(CPT) P(T|E)/P(T) These rows should be scaled to sum to 0.8 These rows should be scaled to sum to 0.2

  11. Issues • If a state is described by n propositions, then a belief state contains 2n states (possibly, some have probability 0) •  Modeling difficulty: many numbers must be entered in the first place •  Computational issue: memory size and time

  12. Independence of events • Two events A=a and B=b are independent if P(A=a  B=b) = P(A=a) P(B=b) hence P(A=a|B=b) = P(A=a) • Knowing B=b doesn’t give you any information about whether A=a is true

  13. Independence of random variables • Two random variables A and B are independent if P(A,B) = P(A) P(B) hence P(A|B) = P(A) • Knowing B doesn’t give you any information about A • [This equality has to hold for all combinations of values that A and B can take on, i.e., all events A=a and B=b are independent]

  14. Significance of independence • If A and B are independent, then P(A,B) = P(A) P(B) • => The joint distribution over A and B can be defined as a product of the distribution of A and the distribution of B • Rather than storing a big probability table over all combinations of A and B, store two much smaller probability tables! • To compute P(A=a  B=b), just look up P(A=a) and P(B=b) in the individual tables and multiply them together

  15. Conditional Independence • Two random variables A and B are conditionally independent given C, if P(A, B|C) = P(A|C) P(B|C)hence P(A|B,C) = P(A|C) • Once you know C, learning B doesn’t give you any information about A • [again, this has to hold for all combinations of values that A,B,C can take on]

  16. Significance of Conditional independence • Consider Rainy, Thunder, and RoadsSlippery • Ostensibly, thunder doesn’t have anything directly to do with slippery roads… • But they happen together more often when it rains, so they are not independent… • So it is reasonable to believe that Thunder and RoadsSlippery are conditionally independent given Rainy • So if I want to estimate whether or not I will hear thunder, I don’t need to think about the state of the roads, just whether or not it’s raining!

  17. Toothache and PCatch are independent given Cavity, but this relation is hidden in the numbers! [Quiz] • Bayesian networks explicitly represent independence among propositions to reduce the number of probabilities defining a belief state

  18. Bayesian Network • Notice that Cavity is the “cause” of both Toothache and PCatch, and represent the causality links explicitly • Give the prior probability distribution of Cavity • Give the conditional probability tables of Toothache and PCatch P(CTP) = P(TP|C) P(C) = P(T|C) P(P|C) P(C) Cavity Toothache PCatch 5 probabilities, instead of 7

  19. Conditional Probability Tables P(CTP) = P(TP|C) P(C) = P(T|C) P(P|C) P(C) Cavity Toothache PCatch Columns sum to 1 If X takes n values, just store n-1 entries

  20. Significance of Conditional independence • Consider Grade(CS101), Intelligence, and SAT • Ostensibly, the grade in a course doesn’t have a direct relationship with SAT scores • but good students are more likely to get good SAT scores, so they are not independent… • It is reasonable to believe that Grade(CS101) and SAT are conditionally independent given Intelligence

  21. bayesian Network • Explicitly represent independence among propositions • Notice that Intelligence is the “cause” of both Grade and SAT, and the causality is represented explicitly P(I,G,S) = P(G,S|I) P(I) = P(G|I) P(S|I) P(I) Intel. Grade SAT 6probabilities, instead of 11

  22. Significance of Bayesian Networks • If we know that variables are conditionally independent, we should be able to decompose joint distribution to take advantage of it • Bayesian networks are a way of efficiently factoring the joint distribution into conditional probabilities • And also building complex joint distributions from smaller models of probabilistic relationships • But… • What knowledge does the BN encode about the distribution? • How do we use a BN to compute probabilities of variables that we are interested in?

  23. Burglary Earthquake causes Alarm effects JohnCalls MaryCalls A More Complex BN Intuitive meaning of arc from x to y: “x has direct influence on y” Directed acyclic graph

  24. Burglary Earthquake Alarm JohnCalls MaryCalls A More Complex BN Size of the CPT for a node with k parents: 2k 10 probabilities, instead of 31

  25. Burglary Earthquake Alarm JohnCalls MaryCalls What does the BN encode? • Each of the beliefs JohnCalls and MaryCalls is independent of Burglary and Earthquake given Alarm or Alarm P(BJ) P(B) P(J) P(BJ|A) =P(B|A) P(J|A) For example, John doesnot observe any burglariesdirectly

  26. Burglary Earthquake Alarm JohnCalls MaryCalls What does the BN encode? • The beliefs JohnCalls and MaryCalls are independent given Alarm or Alarm P(BJ|A) =P(B|A) P(J|A) P(JM|A) =P(J|A) P(M|A) A node is independent of its non-descendants given its parents For instance, the reasons why John and Mary may not call if there is an alarm are unrelated

  27. Burglary Earthquake Alarm JohnCalls MaryCalls What does the BN encode? Burglary and Earthquake are independent A node is independent of its non-descendants given its parents • The beliefs JohnCalls and MaryCalls are independent given Alarm or Alarm For instance, the reasons why John and Mary may not call if there is an alarm are unrelated

  28. Locally Structured World • A world is locally structured (or sparse) if each of its components interacts directly with relatively few other components • In a sparse world, the CPTs are small and the BN contains much fewer probabilities than the full joint distribution • If the # of entries in each CPT is bounded by a constant, i.e., O(1), then the # of probabilities in a BN is linear in n – the # of propositions – instead of 2n for the joint distribution

  29. Equations Involving Random Variables Give Rise to Causality Relationships • C = A  B • C = max(A,B) • Constrains joint probability P(A,B,C) • Nicely encoded as causality relationship A B Conditional probability given by equation rather than a CPT C

  30. Naïve Bayes Models • P(Cause,Effect1,…,Effectn)= P(Cause) Pi P(Effecti | Cause) Cause Effect1 Effect2 Effectn

  31. Bayes’ Rule and other Probability Manipulations • P(A,B) = P(A|B) P(B) = P(B|A) P(A) • P(A|B) = P(B|A) P(A) / P(B) • Gives us a way to manipulate distributions • e.g. P(B) = Sa P(B|A=a) P(A=a) • Can derive P(A|B), P(B) using only P(B|A) and P(A)

  32. P(C|F1,….,Fk) = P(C,F1,….,Fk)/P(F1,….,Fk) = 1/Z P(C)Pi P(Fi|C) Given features, what class? Naïve Bayes Classifier • P(Class,Feature1,…,Featuren)= P(Class) Pi P(Featurei | Class) Spam / Not Spam English / French/ Latin … Class Feature1 Feature2 Featuren Word occurrences

  33. But does a BN represent a belief state?In other words, can we compute the full joint distribution of the propositions from it?

  34. Burglary Earthquake Alarm JohnCalls MaryCalls Calculation of Joint Probability P(JMABE) = ??

  35. Burglary Earthquake Alarm JohnCalls MaryCalls • P(JMABE)= P(JM|A,B,E)  P(ABE)= P(J|A,B,E)  P(M|A,B,E)  P(ABE)(J and M are independent given A) • P(J|A,B,E) = P(J|A)(J and B and J and E are independent given A) • P(M|A,B,E) = P(M|A) • P(ABE) = P(A|B,E)  P(B|E)  P(E) = P(A|B,E)  P(B)  P(E)(B and E are independent) • P(JMABE) = P(J|A)P(M|A)P(A|B,E)P(B)P(E)

  36. Burglary Earthquake Alarm JohnCalls MaryCalls Calculation of Joint Probability P(JMABE)= P(J|A)P(M|A)P(A|B,E)P(B)P(E)= 0.9 x 0.7 x 0.001 x 0.999 x 0.998= 0.00062

  37. Burglary Earthquake Alarm P(x1x2…xn) = Pi=1,…,nP(xi|parents(Xi)) JohnCalls MaryCalls  full joint distribution table Calculation of Joint Probability P(JMABE)= P(J|A)P(M|A)P(A|B,E)P(B)P(E)= 0.9 x 0.7 x 0.001 x 0.999 x 0.998= 0.00062

  38. Burglary Earthquake Alarm P(x1x2…xn) = Pi=1,…,nP(xi|parents(Xi)) JohnCalls MaryCalls  full joint distribution table Calculation of Joint Probability Since a BN defines the full joint distribution of a set of propositions, it represents a belief state P(JMABE)= P(J|A)P(M|A)P(A|B,E)P(b)P(e)= 0.9 x 0.7 x 0.001 x 0.999 x 0.998= 0.00062

  39. Probabilistic Inference • Assume we are given a Bayes net • Usually we aren’t interested in calculating the probability of a setting of all of the variables • For some variables we observe their values directly: observed variables • For others we don’t care: nuisance variables • How can we enforce observed values and ignore nuisance variables, while strictly adhering to the rules of probability? • Probabilistic inference problems

  40. Probability Manipulation Review… • Three fundamental operations • Conditioning • Marginalization • Applying (conditional) independence assumptions

  41. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference Suppose we want to compute P(Alarm)

  42. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference Suppose we want to compute P(Alarm) P(Alarm) = Σb,eP(A,b,e) P(Alarm) = Σb,e P(A|b,e)P(b)P(e)

  43. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference • Suppose we want to compute P(Alarm) • P(Alarm) = Σb,eP(A,b,e) • P(Alarm) = Σb,e P(A|b,e)P(b)P(e) • P(Alarm) = P(A|B,E)P(B)P(E) + P(A|B, E)P(B)P(E) + P(A|B,E)P(B)P(E) +P(A|B,E)P(B)P(E)

  44. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference • Suppose we want to compute P(Alarm) • P(A) = Σb,eP(A,b,e) • P(A) = Σb,e P(A|b,e)P(b)P(e) • P(A) = P(A|B,E)P(B)P(E) + P(A|B, E)P(B)P(E) + P(A|B,E)P(B)P(E) +P(A|B,E)P(B)P(E) • P(A) = 0.95*0.001*0.002 + 0.94*0.001*0.998 + 0.29*0.999*0.002 + 0.001*0.999*0.998 = 0.00252

  45. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference Now, suppose we want to compute P(MaryCalls)

  46. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference Now, suppose we want to compute P(MaryCalls) P(M) = P(M|A)P(A) + P(M|A) P(A)

  47. Burglary Earthquake Alarm JohnCalls MaryCalls Top-Down inference Now, suppose we want to compute P(MaryCalls) P(M) = P(M|A)P(A) + P(M|A) P(A) P(M) = 0.70*0.00252 + 0.01*(1-0.0252) = 0.0117

  48. Cavity Toothache Querying the BN • The BN gives P(T|C) • What about P(C|T)?

  49. Bayes’ Rule • P(AB) = P(A|B) P(B) = P(B|A) P(A) • So… P(A|B) = P(B|A) P(A) / P(B) • A convenient way to manipulate probability equations

  50. Applying Bayes’ Rule • Let A be a cause, B be an effect, and let’s say we know P(B|A) and P(A) (conditional probability tables) • What’s P(B)?

More Related