1 Midterm Exam Mean: 72.7% Max: 100.25% Kernel Density Estimation.

Slides:



Advertisements
Similar presentations
Bayesian Networks CSE 473. © Daniel S. Weld 2 Last Time Basic notions Atomic events Probabilities Joint distribution Inference by enumeration Independence.
Advertisements

Belief networks Conditional independence Syntax and semantics Exact inference Approximate inference CS 460, Belief Networks1 Mundhenk and Itti Based.
Exact Inference in Bayes Nets
Identifying Conditional Independencies in Bayes Nets Lecture 4.
Probabilistic Reasoning (2)
Overview of Inference Algorithms for Bayesian Networks Wei Sun, PhD Assistant Research Professor SEOR Dept. & C4I Center George Mason University, 2009.
From Variable Elimination to Junction Trees
Graphical Models - Inference -
Bayesian network inference
Bayesian Networks Chapter 2 (Duda et al.) – Section 2.11
Inference in Bayesian Nets
. Bayesian Networks For Genetic Linkage Analysis Lecture #7.
. Bayesian Networks Lecture 9 Edited from Nir Friedman’s slides by Dan Geiger from Nir Friedman’s slides.
Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.
. Inference I Introduction, Hardness, and Variable Elimination Slides by Nir Friedman.
5/25/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 16, 6/1/2005 University of Washington, Department of Electrical Engineering Spring 2005.
Bayesian Networks Russell and Norvig: Chapter 14 CMCS424 Fall 2003 based on material from Jean-Claude Latombe, Daphne Koller and Nir Friedman.
CS 188: Artificial Intelligence Spring 2007 Lecture 14: Bayes Nets III 3/1/2007 Srini Narayanan – ICSI and UC Berkeley.
CS 188: Artificial Intelligence Fall 2006 Lecture 17: Bayes Nets III 10/26/2006 Dan Klein – UC Berkeley.
10/22  Homework 3 returned; solutions posted  Homework 4 socket opened  Project 3 assigned  Mid-term on Wednesday  (Optional) Review session Tuesday.
. Approximate Inference Slides by Nir Friedman. When can we hope to approximate? Two situations: u Highly stochastic distributions “Far” evidence is discarded.
Announcements Homework 8 is out Final Contest (Optional)
1 Bayesian Networks Chapter ; 14.4 CS 63 Adapted from slides by Tim Finin and Marie desJardins. Some material borrowed from Lise Getoor.
Bayesian Networks Russell and Norvig: Chapter 14 CMCS421 Fall 2006.
1 CMSC 471 Fall 2002 Class #19 – Monday, November 4.
Approximate Inference 2: Monte Carlo Markov Chain
Bayesian networks Chapter 14. Outline Syntax Semantics.
Reasoning Under Uncertainty: Independence and Inference Jim Little Uncertainty 5 Nov 10, 2014 Textbook §6.3.1, 6.5, 6.5.1,
Undirected Models: Markov Networks David Page, Fall 2009 CS 731: Advanced Methods in Artificial Intelligence, with Biomedical Applications.
Bayesian Networks What is the likelihood of X given evidence E? i.e. P(X|E) = ?
Bayesian networks. Motivation We saw that the full joint probability can be used to answer any question about the domain, but can become intractable as.
1 Chapter 14 Probabilistic Reasoning. 2 Outline Syntax of Bayesian networks Semantics of Bayesian networks Efficient representation of conditional distributions.
2 Syntax of Bayesian networks Semantics of Bayesian networks Efficient representation of conditional distributions Exact inference by enumeration Exact.
Baye’s Rule.
Automated Planning and Decision Making Prof. Ronen Brafman Automated Planning and Decision Making 2007 Bayesian networks Variable Elimination Based on.
Probabilistic Reasoning ECE457 Applied Artificial Intelligence Spring 2007 Lecture #9.
Bayesian Statistics and Belief Networks. Overview Book: Ch 13,14 Refresher on Probability Bayesian classifiers Belief Networks / Bayesian Networks.
Introduction to Bayesian Networks
1 Variable Elimination Graphical Models – Carlos Guestrin Carnegie Mellon University October 11 th, 2006 Readings: K&F: 8.1, 8.2, 8.3,
Learning With Bayesian Networks Markus Kalisch ETH Zürich.
1 CMSC 671 Fall 2001 Class #21 – Tuesday, November 13.
Abduction, Uncertainty, and Probabilistic Reasoning
The famous “sprinkler” example (J. Pearl, Probabilistic Reasoning in Intelligent Systems, 1988)
CPSC 422, Lecture 11Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 11 Oct, 2, 2015.
Bayesian networks and their application in circuit reliability estimation Erin Taylor.
Exact Inference in Bayes Nets. Notation U: set of nodes in a graph X i : random variable associated with node i π i : parents of node i Joint probability:
Inference Algorithms for Bayes Networks
1 CMSC 671 Fall 2001 Class #20 – Thursday, November 8.
CPSC 7373: Artificial Intelligence Lecture 5: Probabilistic Inference Jiang Bian, Fall 2012 University of Arkansas at Little Rock.
1 CMSC 671 Fall 2010 Class #18/19 – Wednesday, November 3 / Monday, November 8 Some material borrowed with permission from Lise Getoor.
Bayes network inference  A general scenario:  Query variables: X  Evidence (observed) variables and their values: E = e  Unobserved variables: Y 
1 Variable Elimination Graphical Models – Carlos Guestrin Carnegie Mellon University October 15 th, 2008 Readings: K&F: 8.1, 8.2, 8.3,
QUIZ!!  T/F: You can always (theoretically) do BNs inference by enumeration. TRUE  T/F: In VE, always first marginalize, then join. FALSE  T/F: VE is.
Web-Mining Agents Data Mining Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme Karsten Martiny (Übungen)
CS 541: Artificial Intelligence Lecture VII: Inference in Bayesian Networks.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk
CS 541: Artificial Intelligence
Russell and Norvig: Chapter 14 CMCS424 Fall 2005
CSCI 5822 Probabilistic Models of Human and Machine Learning
Inference Inference: calculating some useful quantity from a joint probability distribution Examples: Posterior probability: Most likely explanation: B.
Instructors: Fei Fang (This Lecture) and Dave Touretzky
CAP 5636 – Advanced Artificial Intelligence
Professor Marie desJardins,
Class #19 – Tuesday, November 3
CS 188: Artificial Intelligence
CS 188: Artificial Intelligence Fall 2008
Class #16 – Tuesday, October 26
Class #22/23 – Wednesday, November 12 / Monday, November 17
Elimination in Chains A B C E D.
CS 188: Artificial Intelligence Fall 2007
Presentation transcript:

1 Midterm Exam Mean: 72.7% Max: % Kernel Density Estimation

2 HW and Overall Grades Homework Avgs Mean = 78.9% Grades So Far Mean = 77.7% The “grade so far” is based only on homeworks 1-4 and the midterm (~36% of the course grade). It does not include participation, or any project components. ABCF / D (These letter grade breakdowns are a GUIDELINE ONLY and do not override the letter grade breakdown defined in the syllabus.)

3 Bayesian Networks Chapter ; 14.4 CMSC 471 Adapted from slides by Tim Finin and Marie desJardins. Some material borrowed from Lise Getoor.

4 Outline Bayesian networks –Network structure –Conditional probability tables –Conditional independence Inference in Bayesian networks –Exact inference –Approximate inference

5 Bayesian Belief Networks (BNs) Definition: BN = (DAG, CPD) –DAG: directed acyclic graph (BN’s structure) Nodes: random variables (typically binary or discrete, but methods also exist to handle continuous variables) Arcs: indicate probabilistic dependencies between nodes (lack of link signifies conditional independence) –CPD: conditional probability distribution (BN’s parameters) Conditional probabilities at each node, usually stored as a table (conditional probability table, or CPT) –Root nodes are a special case – no parents, so just use priors in CPD:

6 Example BN a b c d e P(C|A) = 0.2 P(C|  A) = P(B|A) = 0.3 P(B|  A) = P(A) = P(D|B,C) = 0.1 P(D|B,  C) = 0.01 P(D|  B,C) = 0.01 P(D|  B,  C) = P(E|C) = 0.4 P(E|  C) = Note that we only specify P(A) etc., not P(¬A), since they have to add to one

7 Conditional independence assumption – where q is any set of variables (nodes) other than and its successors – blocks influence of other nodes on and its successors (q influences only through variables in ) –With this assumption, the complete joint probability distribution of all variables in the network can be represented by (recovered from) local CPDs by chaining these CPDs: q Conditional independence and chaining

8 Chaining: Example Computing the joint probability for all variables is easy: P(a, b, c, d, e) = P(e | a, b, c, d) P(a, b, c, d) by the product rule =P(e | c) P(a, b, c, d) by cond. indep. assumption = P(e | c) P(d | a, b, c) P(a, b, c) =P(e | c) P(d | b, c) P(c | a, b) P(a, b) =P(e | c) P(d | b, c) P(c | a) P(b | a) P(a) a b c d e

9 Topological semantics A node is conditionally independent of its non- descendants given its parents A node is conditionally independent of all other nodes in the network given its parents, children, and children’s parents (also known as its Markov blanket) The method called d-separation can be applied to decide whether a set of nodes X is independent of another set Y, given a third set Z

10 Representational extensions Even though they are more compact than the full joint distribution, CPTs for large networks can require a large number of parameters (O(2 k ) where k is the branching factor of the network) Compactly representing CPTs –Deterministic relationships –Noisy-OR –Noisy-MAX Adding continuous variables –Discretization –Use density functions (usually mixtures of Gaussians) to build hybrid Bayesian networks (with discrete and continuous variables)

11 Inference tasks Simple queries: Computer posterior marginal P(X i | E=e) –E.g., P(NoGas | Gauge=empty, Lights=on, Starts=false) Conjunctive queries: –P(X i, X j | E=e) = P(X i | e=e) P(X j | X i, E=e) Optimal decisions: Decision networks include utility information; probabilistic inference is required to find P(outcome | action, evidence) Value of information: Which evidence should we seek next? Sensitivity analysis: Which probability values are most critical? Explanation: Why do I need a new starter motor?

12 Approaches to inference Exact inference –Enumeration –Belief propagation in polytrees –Variable elimination –Clustering / join tree algorithms Approximate inference –Stochastic simulation / sampling methods –Markov chain Monte Carlo methods –Genetic algorithms –Neural networks –Simulated annealing –Mean field theory

13 Direct inference with BNs Instead of computing the joint, suppose we just want the probability for one variable Exact methods of computation: –Enumeration –Variable elimination Join trees: get the probabilities associated with every query variable

14 Inference by enumeration Add all of the terms (atomic event probabilities) from the full joint distribution If E are the evidence (observed) variables and Y are the other (unobserved) variables, then: P(X|e) = α P(X, E) = α ∑ P(X, E, Y) Each P(X, E, Y) term can be computed using the chain rule Computationally expensive!

15 Example: Enumeration P(x i ) = Σ πi P(x i | π i ) P(π i ) Suppose we want P(D=true), and only the value of E is given as true P (d|e) =  Σ ABC P(a, b, c, d, e) =  Σ ABC P(a) P(b|a) P(c|a) P(d|b,c) P(e|c) With simple iteration to compute this expression, there’s going to be a lot of repetition (e.g., P(e|c) has to be recomputed every time we iterate over C=true) a b c d e

16 Exercise: Enumeration smartstudy preparedfair pass p(smart)=.8p(study)=.6 p(fair)=.9 p(prep|…)smart  smart study.9.7  study.5.1 p(pass|…) smart  smart prep  prep prep  prep fair  fair.1 Query: What is the probability that a student studied, given that they pass the exam?

17 Variable elimination Basically just enumeration, but with caching of local calculations Linear for polytrees (singly connected BNs) Potentially exponential for multiply connected BNs  Exact inference in Bayesian networks is NP-hard! Join tree algorithms are an extension of variable elimination methods that compute posterior probabilities for all nodes in a BN simultaneously

18 Variable elimination General idea: Write query in the form Iteratively –Move all irrelevant terms outside of innermost sum –Perform innermost sum, getting a new term –Insert the new term into the product

19 Variable elimination: Example Rain Sprinkler Cloudy WetGrass

20 Computing factors RSCP(R|C)P(S|C)P(C)P(R|C) P(S|C) P(C) TTT TTF TFT TFF FTT FTF FFT FFF RSf 1 (R,S) = ∑ c P(R|S) P(S|C) P(C) TT TF FT FF

21 A more complex example Visit to Asia Smoking Lung Cancer Tuberculosis Abnormality in Chest Bronchitis X-Ray Dyspnea “Asia” network:

22 V S L T A B XD We want to compute P(d) Need to eliminate: v,s,x,t,l,a,b Initial factors

23 V S L T A B XD We want to compute P(d) Need to eliminate: v,s,x,t,l,a,b Initial factors Eliminate: v Note: f v (t) = P(t) In general, result of elimination is not necessarily a probability term Compute:

24 V S L T A B XD We want to compute P(d) Need to eliminate: s,x,t,l,a,b Initial factors Eliminate: s Summing on s results in a factor with two arguments f s (b,l) In general, result of elimination may be a function of several variables Compute:

25 V S L T A B XD We want to compute P(d) Need to eliminate: x,t,l,a,b Initial factors Eliminate: x Note: f x (a) = 1 for all values of a !! Compute:

26 V S L T A B XD We want to compute P(d) Need to eliminate: t,l,a,b Initial factors Eliminate: t Compute:

27 V S L T A B XD We want to compute P(d) Need to eliminate: l,a,b Initial factors Eliminate: l Compute:

28 V S L T A B XD We want to compute P(d) Need to eliminate: b Initial factors Eliminate: a,b Compute:

29 Dealing with evidence How do we deal with evidence? Suppose we are give evidence V = t, S = f, D = t We want to compute P(L, V = t, S = f, D = t) V S L T A B XD

30 Dealing with evidence We start by writing the factors: Since we know that V = t, we don’t need to eliminate V Instead, we can replace the factors P(V) and P(T|V) with These “select” the appropriate parts of the original factors given the evidence Note that f p(V) is a constant, and thus does not appear in elimination of other variables V S L T A B XD

31 Dealing with evidence Given evidence V = t, S = f, D = t Compute P(L, V = t, S = f, D = t ) Initial factors, after setting evidence: V S L T A B XD

32 Given evidence V = t, S = f, D = t Compute P(L, V = t, S = f, D = t ) Initial factors, after setting evidence: Eliminating x, we get V S L T A B XD Dealing with evidence

33 Dealing with evidence Given evidence V = t, S = f, D = t Compute P(L, V = t, S = f, D = t ) Initial factors, after setting evidence: Eliminating x, we get Eliminating t, we get V S L T A B XD

34 Dealing with evidence Given evidence V = t, S = f, D = t Compute P(L, V = t, S = f, D = t ) Initial factors, after setting evidence: Eliminating x, we get Eliminating t, we get Eliminating a, we get V S L T A B XD

35 Dealing with evidence Given evidence V = t, S = f, D = t Compute P(L, V = t, S = f, D = t ) Initial factors, after setting evidence: Eliminating x, we get Eliminating t, we get Eliminating a, we get Eliminating b, we get V S L T A B XD

36 Variable elimination algorithm Let X 1,…, X m be an ordering on the non-query variables For i = m, …, 1 –Leave in the summation for X i only factors mentioning X i –Multiply the factors, getting a factor that contains a number for each value of the variables mentioned, including X i –Sum out X i, getting a factor f that contains a number for each value of the variables mentioned, not including X i –Replace the multiplied factor in the summation

37 Complexity of variable elimination Suppose in one elimination step we compute This requires multiplications (for each value for x, y 1, …, y k, we do m multiplications) and additions (for each value of y 1, …, y k, we do |Val(X)| additions) ►Complexity is exponential in the number of variables in the intermediate factors ►Finding an optimal ordering is NP-hard

38 Exercise: Variable elimination smartstudy preparedfair pass p(smart)=.8p(study)=.6 p(fair)=.9 p(prep|…)smart  smart study.9.7  study.5.1 p(pass|…) smart  smart prep  prep prep  prep fair  fair.1 Query: What is the probability that a student is smart, given that they pass the exam?

39 Conditioning Conditioning: Find the network’s smallest cutset S (a set of nodes whose removal renders the network singly connected) –In this network, S = {A} or {B} or {C} or {D} For each instantiation of S, compute the belief update with the polytree algorithm Combine the results from all instantiations of S Computationally expensive (finding the smallest cutset is in general NP- hard, and the total number of possible instantiations of S is O(2 |S| )) a b c d e

40 Approximate inference: Direct sampling Suppose you are given values for some subset of the variables, E, and want to infer values for unknown variables, Z Randomly generate a very large number of instantiations from the BN –Generate instantiations for all variables – start at root variables and work your way “forward” in topological order Rejection sampling: Only keep those instantiations that are consistent with the values for E Use the frequency of values for Z to get estimated probabilities Accuracy of the results depends on the size of the sample (asymptotically approaches exact results)

41 Exercise: Direct sampling smartstudy preparedfair pass p(smart)=.8p(study)=.6 p(fair)=.9 p(prep|…)smart  smart study.9.7  study.5.1 p(pass|…) smart  smart prep  prep prep  prep fair  fair.1 Topological order = …? Random number generator:.35,.76,.51,.44,.08,.28,.03,.92,.02,.42

42 Likelihood weighting Idea: Don’t generate samples that need to be rejected in the first place! Sample only from the unknown variables Z Weight each sample according to the likelihood that it would occur, given the evidence E

43 Markov chain Monte Carlo algorithm So called because –Markov chain – each instance generated in the sample is dependent on the previous instance –Monte Carlo – statistical sampling method Perform a random walk through variable assignment space, collecting statistics as you go –Start with a random instantiation, consistent with evidence variables –At each step, for some nonevidence variable, randomly sample its value, consistent with the other current assignments Given enough samples, MCMC gives an accurate estimate of the true distribution of values

44 Exercise: MCMC sampling smartstudy preparedfair pass p(smart)=.8p(study)=.6 p(fair)=.9 p(prep|…)smart  smart study.9.7  study.5.1 p(pass|…) smart  smart prep  prep prep  prep fair  fair.1 Topological order = …? Random number generator:.35,.76,.51,.44,.08,.28,.03,.92,.02,.42

45 Summary Bayes nets –Structure –Parameters –Conditional independence –Chaining BN inference –Enumeration –Variable elimination –Sampling methods