510 likes | 515 Views
Learn about Bayesian Networks and how they are used in probabilistic reasoning. Discover how to represent knowledge in uncertain domains and how to perform exact inference in Bayesian Networks.
E N D
Artificial Intelligence: Representation and Problem SolvingProbabilistic Reasoning (2): Bayesian Networks 15-381 / 681 Instructors: Fei Fang (This Lecture) and Dave Touretzky feifang@cmu.edu Wean Hall 4126
Recap • Probability Models • Joint probability distribution of random variables • Probabilistic Inference • Compute Marginal probability or Conditional probability • Chain Rule, Independence, Bayes’ Rule • Full joint distribution is hard to estimate and too big to represent explicitly Fei Fang
Outline • Bayesian Networks • Independence in Bayes’ Net • Construct a Bayes’ Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Bayesian Network • Bayesian Network (Bayes’ net) Overview • A compact way to represent knowledge in an uncertain domain • Describe full joint probability distributions using simple, local distributions • A probabilistic graphical model • A directed acyclic graph • Each node corresponds to a random variable • Each direct edge represent is a parent of • Each node has a conditional probability distribution (≈ “directly influences”) Way to Commute to Work Weather Sleeping Quality Fei Fang
Example: Alarm • I’m at work, both of my neighbors John and Mary call to say my alarm for burglary is ringing. Sometimes it’s set off by minor earthquakes. Is there a burglary? • How do we model this scenario? How can we represent our knowledge in such a domain with uncertainty? Fei Fang
Example: Alarm • Random Variables: , , , , • Domain • Knowledge base: Full joint probability distribution • How big is the table? • Task: Compute Fei Fang
Example: Alarm • Recall Independence • Can be represented much more efficiently! • Are all the random variables independent in this example? Fei Fang
Example: Alarm • However, there are some intuitive independence relationships based on our causal knowledge! • Causal knowledge – • A burglary can set the alarm off • An earthquake can set the alarm off • The alarm can cause Mary to call • The alarm can cause John to call Burglary Earthquake Alarm MaryCalls JohnCalls Fei Fang
Example: Alarm • and are independent with each other • Conditioned on the value of , and are independent • Similar independence assumptions for and • Conditioned on the value of , and are independent with each other Burglary (B), Earthquake (E), Alarm (A), JohnCalls (J), MaryCalls (M)
Example: Alarm • Given these independence relationships, • We don’t need fill the full joint probability table anymore to represent our knowledge! • Only need to provide these conditional probabilities • Is this better or worse? Fei Fang
Example: Alarm How many numbers we need here? ! Recall we need for the original table. burglary (B), Earthquake (E), Alarm (A), JohnCalls (J), MaryCalls (M)
Example: Alarm Enrich the network with more links: more realistic, less compact Fei Fang
Bayesian Network • Bayesian Network: A compact way to represent knowledge in an uncertain domain Fei Fang
Bayesian Network • Bayesian Network: Describe full joint probability distributions using simple, local distributions Global semantics Have to be equivalent! Fei Fang
Bayesian Network • Bayesian Network: Describe full joint probability distributions using simple, local distributions • What is ? means Have to be equivalent! Fei Fang
Bayesian Network • Bayesian Network: A probabilistic graphical model • A directed acyclic graph • Node – random variable; Edge – parent-child relationship • Conditional probability distribution • Often represented by CPT (conditional probability table) A Bayes’ Net = topology (graph) + local conditional probabilities Fei Fang
Quiz 1 • At least how many entries are needed for a general CPT (conditional probability table) for the node “Way to Commute to Work”? • A: 18 • B: 12 • C: 6 • D: 3 Weather Way to Commute to Work Sleeping Quality Fei Fang
Quiz 1 Weather Way to Commute to Work Sleeping Quality Fei Fang
Another Perspective of Bayes’ Net • Assume you have no “causal knowledge” but someone gives you the full joint probability table • You observe there is a valid factorization of the full joint probability distribution • You further observe that such factorization can be represented using a DAG • You can prove ’s equal to “conditional probabilities” • Now you get a Bayes’ Net Fei Fang
Outline • Bayesian Networks • Independence in Bayes’ Net • Construct a Bayes’ Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Independence in Bayes’ Net • Given a Bayes’ Net, which variables are independent? • Each node is conditionally independent of its non-descendants given its parents Local semantics Given , is independent of Fei Fang
Independence in Bayes’ Net • Each node is conditionally independent of all others given its Markov blanket: parents + children + children’s parents Fei Fang
Example • List all the independence relationships Local Semantics: Each node is conditionally independent of its non-descendants given its parents Each node is conditionally independent of all others given its Markov blanket: parents + children + children’s parents Fei Fang
Quiz 2 • Which of the following statements of independence are true given the Bayes’ Net based on local semantics and Markov blankets? • A: • B: • C: • D: • E: B C A D E G F Local Semantics: Each node is conditionally independent of its non-descendants given its parents Each node is conditionally independent of all others given its Markov blanket: parents + children + children’s parents H Fei Fang
Outline • Bayesian Networks • Independence in Bayes’ Net • Construct a Bayes’ Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Is Bayes’ Net Expressive Enough? • Any full joint probability table can be represented by a Bayes’ Net Fei Fang
Is Bayes’ Net Unique? • One (full joint probability distribution)-to-many (Bayes’ Net) mapping Fei Fang
Construct a Bayes’ Net • Construct a (ideally simple) Bayes’ Net systematically As a knowledge engineer or domain expert Choose an ordering of variables For Add to the network Select a minimal subset of variables from , denoted such that Add edges from nodes in to , write down the conditional probability table (CPT) This process guarantees Fei Fang
Construct a Bayes’ Net • Construct a (ideally simple) Bayes’ Net systematically • Ordering of variables matters • Exploit domain knowledge to determine the ordering: intuitively, parent of a node should contain all nodes that directly influences Fei Fang
Outline • Bayesian Networks • Independence in Bayes’ Net • Construct a Bayes’ Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Probabilistic Inference in Bayes’ Net • Recap: Probabilistic inference: • No evidence: Marginal probability • With evidence: Posterior / Conditional probability • Inference with full joint probability distribution: Marginalization, Bayes’ Rule • Exact Inference in Bayes’ Net: (1) Enumeration; (2) Variable Elimination Fei Fang
General Inference Procedure • Partition the set of random variables in the model • Evidence variables , and be e the list of observed values from them • Remaining unobserved / hidden variables • Query variables • The query can be answered by Fei Fang
Inference in Bayes’ Net • Inference with full joint probability distribution table available: Read the joint probability from the table • Inference in Bayes’ Net: compute joint probability through conditional probability table Fei Fang
Example: Alert • I’m at work, both of my neighbors John and Mary call to say my alarm for burglary is ringing. Sometimes it’s set off by minor earthquakes. Is there a burglary? Fei Fang
Example: Alert • Evaluate through depth-first recursion of the following expression tree Top-down DF evaluation: × Values along each path + at the branching nodes Fei Fang
Example: Alert • Normalize Fei Fang
Exact Inference in Bayes’ Net: Variable Elimination • Avoid repeated computation of subexpressions in the enumeration algorithm • Similar to dynamic programming Fei Fang
Outline • Bayesian Networks • Independence in Bayes’ Net • Construct a Bayes’ Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Bayes’ Net as a Model of Real World • Bayes’ Net represents knowledge in an uncertain domain • View it as a way to model the real world based on domain knowledge • Is your model (Bayes’ Net) for a real-world problem correct? Not necessarily. Fei Fang
Bayes’ Net as a Model of Real World • "All models are wrong“ • Acommon aphorism in statistics • Generally attributed to the statistician George Box "Essentially, all models are wrong, but some are useful". https://en.wikipedia.org/wiki/All_models_are_wrong Fei Fang
Use of Bayes’ Net • Diagnosis: (cause | symptom)? • Prediction: (symptom | cause)? • Classification: (class | data) • Decision-making (given a cost function) Fei Fang
Use of Bayes’ Net Russel and Novig Fei Fang
Summary • Bayes’ Net • Graphical model • Decompose full joint probability distributions into interpretable, simple, local distributions • Independence in Bayes’ Net • Local semantics • Markov Blanket • Construct a Bayes Net • Exact Inference in Bayes’ Net • Applications of Bayes’ Net Fei Fang
Acknowledgment • Some slides are borrowed from previous slides made by Tai Sing Lee Fei Fang
Backup Slides Fei Fang
Conditional Independence • Example graph (1) Fei Fang
Conditional Independence • Example graph (2) Fei Fang
Conditional Independence • Example graph (3) Fei Fang
D-Separation for Conditional Independence • is valid in general if and only if all the paths from any node in to any node in are blocked • A path is blocked if and only if it includes a node such that either one of the following statements are true • The rows on the path meet head-to-tail or tail-to-tail at the node, and the node is in the set • The rows on the path meet head-to-head at the node, and neither the node nor any of its descendants, is in the set Head-to-tail at Tail-to-tail at Head-to-head at Fei Fang