Propagation Algorithm in Bayesian Networks

Slides:



Advertisements
Similar presentations
Introduction to Decision Analysis
Advertisements

Chapter 4 Probability.
Go to Table of ContentTable of Content Analysis of Variance: Randomized Blocks Farrokh Alemi Ph.D. Kashif Haqqi M.D.
Undirected Models: Markov Networks David Page, Fall 2009 CS 731: Advanced Methods in Artificial Intelligence, with Biomedical Applications.
Copyright © Cengage Learning. All rights reserved. 4 Quadratic Functions.
Chapter 4 Probability ©. Sample Space sample space.S The possible outcomes of a random experiment are called the basic outcomes, and the set of all basic.
Probability 2 Compound Probability.  Now lets consider the following:  2 dice are rolled and the numbers are added together.  What are the numbers.
4 Proposed Research Projects SmartHome – Encouraging patients with mild cognitive disabilities to use digital memory notebook for activities of daily living.
Course 2 Probability Basics 7.9 and Theoretical Probability Theoretical Probability is the ratio of the number of ways an event can occur to the.
Lecture #8 Thursday, September 15, 2016 Textbook: Section 4.4
Chapter 15 Random Variables.
Linear Algebra Review.
Random Variables Random variables assigns a number to each outcome of a random circumstance, or equivalently, a random variable assigns a number to each.
Naive Bayes Classifier
Chapter 5: Probability: What are the Chances?
Lecture Slides Elementary Statistics Twelfth Edition
Lesson 2-1 Properties of Numbers.
Partial Products Algorithm for Multiplication
Probability Distributions for Discrete Variables
Data Mining Lecture 11.
Introduction to Probabilities
Normal Distribution Farrokh Alemi Ph.D.
Lecture Slides Elementary Statistics Twelfth Edition
Log Linear Modeling of Independence
Introduction to Summary Statistics
Bayesian Networks HAP 823 George Mason University
Probability Calculus Farrokh Alemi Ph.D.
Read R&N Ch Next lecture: Read R&N
Hidden Markov Models Part 2: Algorithms
Observations, Variables and Data Matrices
SQL for Predicting from Likelihood Ratios
Causal Networks Farrokh Alemi, PhD.
SQL for Calculating Likelihood Ratios
Types of Joins Farrokh Alemi, Ph.D.
SQL for Cleaning Data Farrokh Alemi, Ph.D.
Inferential Statistics
Probability Topics Random Variables Joint and Marginal Distributions
Calculating Product of Values in Same Column
Receiver Operating Curves
Saturday, August 06, 2016 Farrokh Alemi, PhD.
Test of Independence in 3 Variables
Objective The student will be able to:
Objective The student will be able to:
Rank Order Function Farrokh Alemi, Ph.D.
Test of Independence through Mutual Information
Propagation Algorithm in Bayesian Networks
Critical Path Method Farrokh Alemi, Ph.D.
CS 188: Artificial Intelligence Fall 2008
Creating Tables & Inserting Values Using SQL
4A: Probability Concepts and Binomial Probability Distributions
Comparing two Rates Farrokh Alemi Ph.D.
Chi Square (2) Dr. Richard Jackson
Expectation And Variance of Random Variables
Chapter 5: Control Structure
Chapter 5: Probability: What are the Chances?
Solving Linear Equations
Wednesday, September 21, 2016 Farrokh Alemi, PhD.
Indexing & Computational Efficiency
Benchmarking Clinicians using Data Balancing
Improving Overlap Farrokh Alemi, Ph.D.
Step 5: Analysis of Causal Diary
Chapter3 Fixed Point Representation
Expectation And Variance of Random Variables
Benchmarking Clinicians using Data Balancing
Risk Adjusted P-chart Farrokh Alemi, Ph.D.
Stratified Covariate Balancing Using R
Standard Normal Table Area Under the Curve
Categorical Data By Farrokh Alemi, Ph.D.
Tree Diagrams Be able to use a tree diagram to list the possible outcomes from two events. Be able to calculate probabilities from tree diagrams. Understand.
Standard Normal Table Area Under the Curve
Presentation transcript:

Propagation Algorithm in Bayesian Networks Saturday, August 20, 2016 Farrokh Alemi, PhD. This lecture shows how to predict an event given a Bayesian network and its specifications. The lecture describes Bayes belief network propagation and based in part on the information in https://www.youtube.com/watch?v=oYKAfYFmsoM and in http://www.cse.unsw.edu.au/~cs9417ml/Bayes/Pages/PearlPropagation.html

Definition: Partial Table p(S,T) S T p Severe Treated 0.4 Not Treated 0.1 Not Severe 0.2 Not severe 0.3 Total 1 p(s,T) S T p Not Severe Treated 0.2 Not severe Not Treated 0.3 Total 0.5 Recall that partial table refers to portion of a table with fixed levels of a variable. On the left we see a table for the combination of severity and treatment. Note that capital letters in our formula refers to all levels of the variables so with capital S we refer to both severe and not severe levels. The table on the left provides the frequency with which the treatment occurs in patients with different combination of severity and treatment. The first row says that 40% of patients we see are severely ill and treated. The last row says that 30% are not severely ill and not treated. On the right we see the partial table for patients who are not severely ill. Note that in a partial tables the probabilities do not add to 1.

Definition: Conditional Table p(s,T) S T p Not Severe Treated 0.2 Not severe Not Treated 0.3 Total 0.5 p(T|s) S T p Not Severe Treated 0.4 Not severe Not Treated 0.6 Total 1 A single conditional refers to the probability of a variable given fixed levels of another. In here we see that probability of treatment among patients who were not severely ill. Note that in a conditional table the probabilities add up to 1.

Definition: Two Separate Conditionals p(s|T) s T p Not Severe Treated 0.2 Not severe Not Treated 0.3 One can also estimate the conditional probability of having a particular value of another variable. There is of course no reason for this to add up to one.

Cycles of Joining & Eliminating Join tables with unwanted variable Eliminate unwanted variables Stop if no unwanted variables The effect of changes in a network can be calculated by repeatedly going through two steps known as joining and eliminating.

Cycles of Joining & Eliminating R ? Cycles of Joining & Eliminating p(S) S p Severe 0.1 Not Severe 0.9 Total 1 p(R|S) S R p Severe DNR 0.8 No DNR 0.2 Not Severe 0.1 Not severe 0.9 Let us start with a simple tree with 3 variables: patients severity, patients preferences for DNR and treatment choice. Our task is to estimate the probability of treatment. To start with we have two tables. One providing the prior probability of severity and the other conditional probability of DNR order at different levels of severity. We will try to first join these two tables.

Joining S T R ? 0.1 x 0.8 0.1 x 0.2 0.9 x 0.1 0.9 x 0.9 p(S) S p Severe 0.1 Not Severe 0.9 p(R|S) S R p Severe DNR 0.8 No DNR 0.2 Not Severe 0.1 Not severe 0.9 p(R,S) S R p Severe DNR 0.08 No DNR 0.02 Not Severe 0.09 Not severe 0.81 0.1 x 0.8 0.1 x 0.2 The joining works like joining of tables in SQL. The tables are joined on variables they share, in this case the severity of the illness. The values of the new joint table are provided by multiplying each conditional probability by the prior probability of the condition. For example, the first row of the new joint table is provided by multiplying the probability of being severe, .1 from the first table to the conditional probability of DNR for severe patients, .8 from the second table. The resulting new table can be used to join with another. But before we join to another table, we need to eliminate the variables that we are not interested in. 0.9 x 0.1 0.9 x 0.9

Elimination (Sum Over Undesirables) ? Elimination (Sum Over Undesirables) p(R,S) S R p Severe DNR 0.08 No DNR 0.02 Not Severe 0.09 Not severe 0.81 p(R) R p DNR 0.17 No DNR 0.83 p(R,S) Sorted S R p Severe DNR 0.08 Not Severe 0.09 No DNR 0.02 Not severe 0.81 Elimination is done by summing over the variable that we are not interested in. Since we want to estimate the probability of treatment, we are not interested in the patient’s severity. We can eliminate this variable by summing across it. To show the summation easier we sorted over the variable we want to keep. The we sum the values for DNR and no DNR. This new table no longer indicates severity of illness but reflects the influence of severity.

Join Again S T R ? p(R) R p DNR 0.17 No DNR 0.83 p(T|R) T R p Treated 0.08 No DNR 0.61 Not Treated 0.20 0.11 p(T,R) T R p Treated DNR 0.014 No DNR 0.506 Not Treated 0.034 0.091 For our next step we join our new table with the conditional probability of treatment given DNR. We are joining the two tables on the shared variables across the two tables. In this case the two tables share the DNR choice. As before, the shared feature across the two tables is used to multiply the related probabilities.

Eliminate Again S T R ? p(T,R) T R p Treated DNR 0.014 No DNR 0.506 Not Treated 0.034 0.091 p(T) T p Treated 0.52 Not Treated 0.125 Total 0.645 p(T) T p p normalized Treated 0.52 0.81 Not Treated 0.13 0.19 Total 0.65 1 Since we are interested in the probability of treatment, then we can eliminate DNR variable by summing across it. Since these calculated estimates do not always add up to 1, we normalize the estimates so that they do. So in the final estimate we have that 81% of the patients receive the treatment. We have been able to go through the tree and estimate the probability of treatment.

Algorithm with Substantiated Variables Join tables with unwanted variable Eliminate unwanted variables Stop if no unwanted variables Remove unsubstantiated rows If a variable is substantiated, meaning that it has occurred, then we remove all rows corresponding to unsubstantiated levels of the variable. Then we first join all substantiated variables. Then join a table with a variable not needed at end of the calculation. This is done through multiplication of probabilities of joined tables. Next eliminate the unneeded variable. This is done through summation. If all unneeded variables are eliminated then normalize and use the estimated probabilities. Let us look at an example.

Remove Unsubstantiated Levels p(severity) p(DNR) p(Tx|DNR, Severity) p(Outcome|Tx, Severity) Severity p DNR Tx Outcome Severe 0.4 Yes 0.1 Positive 0.2 Not Severe 0.6 No Negative 0.0 0.3 Let us assume that we want to predict the outcome for severe patients. Therefore, rows that correspond to not severely ill patients should be removed from all tables. These are the four local tables in our network.

Remove Unsubstantiated Levels p(severity) p(DNR) p(Tx|DNR, Severity) p(Outcome|Tx, Severity) Severity p DNR Tx Outcome Severe 0.4 Yes 0.1 Positive 0.2 Not Severe 0.6 No Negative 0.0 0.3 Since we are focused on severe patients, the rows from three tables about “not severely ill” patients are removed. Typically, this is done by a where SQL command at the point of joining tables.

Join Severity and DNR S R T O SELECT [p(Sev)].Severity, [p(DNR)].DNR, [p(DNR)]![p]*[p(Sev)]![p] AS p FROM [p(DNR)], [p(Sev)] WHERE ((([p(Sev)].Severity)="Severe")); This code says that we should join the two tables. Since they have no shared features, the join is cross join. After the join the probability of combination events are calculated as a product of the probabilities. It also says that the join should be limited to severe cases. The resulting join is shown here. The probability of severe illness and DNR is estimated as 0.16, which is the product of 0.4 in the other two tables. p(severity) p(DNR) Severity p DNR Severe 0.4 Yes Not Severe 0.6 No p(Sev DNR) Severity DNR p Severe Yes 0.16 No 0.24

No Elimination S R T O p(Sev DNR) Severity DNR p Severe Yes 0.16 No 0.24 We cannot eliminate neither DNR or Severity from this table as these variables are also used in remaining network structure. Severity is used in both treatment and outcome tables and DNR is used in the treatment variable

Join Again S R T O p(Sev DNR) Severity DNR p Severe Yes 0.16 No 0.24 p(Tx|DNR, Severity) DNR Severity Tx p Yes Severe 0.1 No 0.2 Not Severe 0.0 0.3 p(Sev DNR) Severity DNR p Severe Yes 0.16 No 0.24 In our next step we want to join the combined table of Severity and DNR with table for treatment.

Join Again S R T O SELECT [p(Tx|DNR Sev)].Tx, [p(Tx|DNR Sev)].Severity, [p(Tx|DNR Sev)].DNR, +[p(Tx|DNR Sev)]![p]*[p(Sev DNR)]![p] AS p FROM [p(Sev DNR)] INNER JOIN [p(Tx|DNR Sev)] ON ([p(Sev DNR)].Severity = [p(Tx|DNR Sev)].Severity) AND ([p(Sev DNR)].DNR = [p(Tx|DNR Sev)].DNR); The SQL for this join is given as shown. Note that the two tables now share two features; severity and DNR orders.

Join Again with Treatment S T R Join Again with Treatment p(Sev DNR) p(Tx|DNR, Severity) Severity DNR p Tx Severe Yes 0.16 0.1 No 0.072 0.24 0.2 0.024 0.3 0.016 0.032 The resulting Table is provided here. Note that only the severe cases are carried through the join as the earlier tables do not have cases of not severely ill patients. Note that that probability in the resulting tables do not add up to one. This is ok, these estimates do not have to add up to one. We can now remove the DNR variable as it is no longer in use in any remaining tables.

O S T R Eliminate DNR SELECT [p(Tx Sev DNR)].Tx, [p(Tx Sev DNR)].Severity, Sum([p(Tx Sev DNR)].p) AS psum FROM [p(Tx Sev DNR)] GROUP BY [p(Tx Sev DNR)].Tx, [p(Tx Sev DNR)].Severity; We can eliminate DNR by grouping by the other variables in the table and summing across DNR. The code and the result are shown here. In our final join we would join with the table on outcomes. p(Tx Sev) Tx Severity psum No Severe 0.06 Yes 0.09

p(Outcome|Tx, Severity) Join with Outcomes p(Tx Sev) p(Outcome|Tx, Severity) Tx Severity psum Outcome p No Severe 0.06 Yes Positive 0.2 0.09 Negative 0.1 0.3 The two tables that we need to join are shown here. Note how the non severe cases are no longer part of each table.

p(Outcome|Tx, Severity) Join with Outcomes p(Tx Sev) p(Outcome|Tx, Severity) p(Tx Sev Outcome) Tx Severity psum Outcome p No Severe 0.06 Yes Positive 0.2 0.018 0.09 Negative 0.1 0.009 0.006 0.3 0.017 Note again that in the new table of treatment, severity and outcome, the calculated probabilities do not add up to one These numbers are proportional to probability and normalizing them to add up to one results in the calculated probabilities. Next we try to eliminate all variables that are not needed and calculate the probability of positive outcome.

Eliminate Treatment S R T O SELECT [p(tx sev outcome)].Severity, [p(tx sev outcome)].Outcome, Sum([p(tx sev outcome)]![p]/[SumOfp]) AS p FROM [p(tx sev outcome)], SumOfP GROUP BY [p(tx sev outcome)].Severity, [p(tx sev outcome)].Outcome; Here again we sum across the groups we want and leave the variables we are not interested out of the group by statement   Severity Outcome p Severe Negative 0.52 Positive 0.48

Cycles of Join and Elimination Leads to Desired Probabilities Take Home Lesson Cycles of Join and Elimination Leads to Desired Probabilities Here again we sum across the groups we want and leave the variables we are not interested out of the group by statement