have a fever 发烧 have a toothache 牙疼 have a fever 发烧 have a toothache 牙疼.
Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes...
Transcript of Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes...
![Page 1: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/1.jpg)
Bayes Networks
Robert PlattNortheastern University
Some images, slides, or ideas are used from:1. AIMA2. Berkeley CS1883. Chris Amato
![Page 2: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/2.jpg)
What is a Bayes Net?
![Page 3: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/3.jpg)
What is a Bayes Net?
Suppose we're given this distribution:
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Variables:CavityToothache (T)Catch (C)
![Page 4: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/4.jpg)
What is a Bayes Net?
Suppose we're given this distribution:
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Variables:CavityToothache (T)Catch (C)
Can we summarize aspects of this probability distribution with a graph?
![Page 5: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/5.jpg)
What is a Bayes Net?
This diagram captures important information that is hard to extract from table by looking at it:
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Cavity
toothache catch
![Page 6: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/6.jpg)
What is a Bayes Net?
This diagram captures important information that is hard to extract from table by looking at it:
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Cavity
toothache catch
Cavity causes toothache Cavity causes
catch
![Page 7: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/7.jpg)
What is a Bayes Net?
Bubbles: random variables
Arrows: dependency relationships between variables
Something that looks like this:
![Page 8: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/8.jpg)
What is a Bayes Net?
Bubbles: random variables
Arrows: dependency relationships between variables
Something that looks like this:
A Bayes net is a compact way of representing a probability distribution
![Page 9: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/9.jpg)
Bayes net example
Cavity
toothache catch
Diagram encodes the fact that toothache is conditionally independent of catch given cavity
– therefore, all we need are the following distributions
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
Prior probability of cavity
Prob of catch given cavity
Prob of toothache given cavity
![Page 10: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/10.jpg)
Bayes net example
Cavity
toothache catch
Diagram encodes the fact that toothache is conditionally independent of catch given cavity
– therefore, all we need are the following distributions
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
Prior probability of cavity
Prob of catch given cavity
Prob of toothache given cavity
This is called a “factored” representation
![Page 11: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/11.jpg)
Bayes net example
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
How do we recover joint distribution from factored representation?
Cavity
toothache catch
![Page 12: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/12.jpg)
Bayes net example
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
P(T,C,cavity) = P(T,C|cav)P(cav)
= P(T|cav)P(C|cav)P(cav)
What is this step?
What is this step?
Cavity
toothache catch
![Page 13: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/13.jpg)
Bayes net example
Cavity
toothache catch
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
P(T,C,cavity) = P(T,C|cav)P(cav)
How calculate these?
= P(T|cav)P(C|cav)P(cav)
![Page 14: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/14.jpg)
Bayes net example
cavity P(T|cav)
true 0.9
false 0.3
cavity P(C|cav)
true 0.9
false 0.2
P(cavity) = 0.2
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
P(T,C,cavity) = P(T,C|cav)P(cav)
How calculate these?
= P(T|cav)P(C|cav)P(cav)
In general:
Cavity
toothache catch
![Page 15: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/15.jpg)
Another example
![Page 16: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/16.jpg)
Another example
?
![Page 17: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/17.jpg)
Another example
![Page 18: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/18.jpg)
Another example
How much space did the BN representation save?
![Page 19: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/19.jpg)
A simple example
winter
snow
winter P(S|W)
true 0.3
false 0.01
Parameters of Bayes network Structure of Bayes network
P(winter)=0.5
winter
snow 0.15
!snow 0.35
!winter
0.005
0.495
Joint distribution implied by bayes network
![Page 20: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/20.jpg)
A simple example
snow
winter
snow P(W|S)
true 0.968
false 0.414
Parameters of Bayes network Structure of Bayes network
P(snow)=0.155
winter
snow 0.15
!snow 0.35
!winter
0.005
0.495
Joint distribution implied by bayes network
![Page 21: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/21.jpg)
A simple example
snow
winter
snow P(W|S)
true 0.968
false 0.414
Parameters of Bayes network Structure of Bayes network
P(snow)=0.155
winter
snow 0.15
!snow 0.35
!winter
0.005
0.495
Joint distribution implied by bayes network
What does this say about causality and bayes net semantics?
– what does bayes net topology encode?
![Page 22: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/22.jpg)
D-separation
What does bayes network structure imply about conditional independence among variables?
R
T
B
D
L
T’
Are D and T independent?
Are D and T conditionally independent given R?
Are D and T conditionally independent given L?
D-separation is a method of answering these questions...
![Page 23: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/23.jpg)
D-separation
X Y Z
Causal chain:
Z is conditionally independent of X given YIf Y is unknown, then Z is correlated with X
For example:X = I was hungryY = I put pizza in the ovenZ = house caught fire
Fire is conditionally independent of Hungry given Pizza...– Hungry and Fire are dependent if Pizza is unknown– Hungry and Fire are independent if Pizza is known
![Page 24: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/24.jpg)
D-separation
X Y Z
Causal chain:
Z is conditionally independent of X given Y.
For example:X = I was hungryY = I put pizza in the ovenZ = house caught fire
Fire is conditionally independent of Hungry given Pizza...– Hungry and Fire are dependent if Pizza is unknown– Hungry and Fire are independent if Pizza is known
Exercise: Prove it!
![Page 25: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/25.jpg)
D-separation
Causal chain:
Z is conditionally independent of X given Y.
For example:X = I was hungryY = I put pizza in the ovenZ = house caught fire
Fire is conditionally independent of Hungry given Pizza...– Hungry and Fire are dependent if Pizza is unknown– Hungry and Fire are independent if Pizza is known
Exercise: Prove it!
![Page 26: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/26.jpg)
D-separation
Common cause:
Z is conditionally independent of X given Y.If Y is unknown, then Z is correlated with X
For example:X = john callsY = alarmZ = mary calls
X
Y
Z
![Page 27: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/27.jpg)
D-separation
Common cause:
Z is conditionally independent of X given Y.If Y is unknown, then Z is correlated with X
For example:X = john callsY = alarmZ = mary calls
X
Y
Z
Exercise: Prove it!
![Page 28: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/28.jpg)
D-separation
Common effect:
If Z is unknown, then X, Y are independentIf Z is known, then X, Y are correlated
For example:X = burglaryY = earthquakeZ = alarm
X Y
Z
![Page 29: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/29.jpg)
D-separation
Given an arbitrary Bayes Net, you can find out whether two variables are independent just by looking at the graph.
![Page 30: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/30.jpg)
D-separation
Given an arbitrary Bayes Net, you can find out whether two variables are independent just by looking at the graph.
How?
![Page 31: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/31.jpg)
D-separation
Given an arbitrary Bayes Net, you can find out whether two variables are independent just by looking at the graph.
Are X, Y independent given A, B, C?
1. enumerate all paths between X and Y
2. figure out whether any of these paths are active
3. if no active path, then X and Y are independent
![Page 32: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/32.jpg)
D-separation
Are X, Y independent given A, B, C?
1. enumerate all paths between X and Y
2. figure out whether any of these paths are active
3. if no active path, then X and Y are independent
What's an active path?
![Page 33: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/33.jpg)
Active path
Active triples Inactive triples
Any path that has an inactive triple on it is inactiveIf a path has only active triples, then it is active
![Page 34: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/34.jpg)
Example
![Page 35: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/35.jpg)
Example
![Page 36: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/36.jpg)
Example
![Page 37: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/37.jpg)
D-separation
What Bayes Nets do:
– constrain probability distributions that can be represented
– reduce the number of parameters
Constrained by conditional independencies induced by structure
– can figure out what these are by using d-separation
Is there a Bayes Net can represent any distribution?
![Page 38: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/38.jpg)
Exact Inference
winter P(S|W)
true 0.3
false 0.01
P(winter)=0.5 winter
snow
crash
snow P(C|S)
true 0.1
false 0.01
Given this Bayes Network
Calculate P(C)
Calculate P(C|W)
![Page 39: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/39.jpg)
Exact Inference
winter P(S|W)
true 0.3
false 0.01
P(winter)=0.5 winter
snow
crash
snow P(C|S)
true 0.1
false 0.01
Given this Bayes Network
Calculate P(C)
Calculate P(C|W)
![Page 40: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/40.jpg)
Exact Inference
winter P(S|W)
true 0.3
false 0.01
P(winter)=0.5 winter
snow
crash
snow P(C|S)
true 0.1
false 0.01
Given this Bayes Network
Calculate P(C)
Calculate P(C|W)
![Page 41: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/41.jpg)
Inference by enumeration
How exactly calculate this?
Inference by enumeration:
1. calculate joint distribution2. marginalize out variables we don't care about.
![Page 42: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/42.jpg)
Inference by enumeration
How exactly calculate this?
Inference by enumeration:
1. calculate joint distribution2. marginalize out variables we don't care about.
winter P(S|W)
true 0.3
false 0.1
P(winter)=0.5
snow P(C|S)
true 0.1
false 0.01
winter snow
true true
false true
P(c,s,w)
0.015
0.005
true false
false false
0.0035
0.0045
Joint distribution
![Page 43: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/43.jpg)
Inference by enumeration
How exactly calculate this?
Inference by enumeration:
1. calculate joint distribution2. marginalize out variables we don't care about.
Joint distribution
P(C) = 0.015+0.005+0.0035+0.0045
= 0.028
winter snow
true true
false true
P(c,s,w)
0.015
0.005
true false
false false
0.0035
0.0045
![Page 44: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/44.jpg)
Inference by enumeration
How exactly calculate this?
Inference by enumeration:
1. calculate joint distribution2. marginalize out variables we don't care about.
P(C) = 0.015+0.005+0.0035+0.0045
= 0.028
winter snow
true true
false true
P(c,s,w)
0.015
0.005
true false
false false
0.0035
0.0045
Pros/cons?
Pro: it works
Con: you must calculate the full joint distribution first– what's wrong w/ that???
![Page 45: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/45.jpg)
Enumeration vs variable elimination
Join on w
Join on s
Eliminate s
Eliminate w
Join on w
Eliminate w
Join on s
Eliminate s
Enumeration Variable elimination
Variable elimination marginalizes early– why does this help?
![Page 46: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/46.jpg)
Variable elimination
winter P(s|W)
true 0.3
false 0.1
P(winter)=0.5
snow P(c|S)
true 0.1
false 0.01
Join on Wwinter P(s,W)
true 0.15
false 0.05
P(snow)=0.2
Sum out SJoin on Ssnow P(c,S)
true 0.02
false 0.008
P(crash)=0.08
Sum out W
P(snow)=0.2
...
![Page 47: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/47.jpg)
Variable elimination
winter P(s|W)
true 0.3
false 0.1
P(winter)=0.5
snow P(c|S)
true 0.1
false 0.01
Join on Wwinter P(s,W)
true 0.15
false 0.05
P(snow)=0.2
Sum out SJoin on Ssnow P(c,S)
true 0.02
false 0.008
P(crash)=0.08
Sum out W
P(snow)=0.2
How does this change if we are given evidence?– i.e. suppose we are know that it is winter time?
![Page 48: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/48.jpg)
Variable elimination w/ evidence
winter P(s|w)
true 0.3
false 0.1
P(winter)=0.5
Select +wsnow P(s,w)
true 0.15
false 0.35
Sum out SJoin on S
snow P(!c,S,w)
true 0.135
false 0.3465
P(c,w)=0.0185
snow P(c,S,w)
true 0.015
false 0.0035
snow P(c|S)
true 0.1
false 0.01
Sum out S P(!c,w)=0.4815
P(c|w)=0.037
P(!c|w)=0.963
Normalize
![Page 49: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/49.jpg)
Variable elimination: general procedure
Variable elimination:
Given: evidence variables, e_1, …, e_m; variable to infer, QGiven: all CPTs (i.e. factors) in the graphCalculate: P(Q|e_1, dots, e_m)
1. select factors for the given evidence2. select ordering of “hidden” variables: vars = {v_1, …, n_n}3. for i = 1 to n4. join on v_i5. marginalize out v_i6. join on query variable7. normalize on query: P(Q|e_1, dots, e_m)
![Page 50: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/50.jpg)
Variable elimination: general procedure
Variable elimination:
Given: evidence variables, e_1, …, e_m; variable to infer, QGiven: all CPTs (i.e. factors) in the graphCalculate: P(Q|e_1, dots, e_m)
1. select factors for the given evidence2. select ordering of “hidden” variables: vars = {v_1, …, n_n}3. for i = 1 to n4. join on v_i5. marginalize out v_i6. join on query variable7. normalize on query: P(Q|e_1, dots, e_m)
winter P(s|W)true 0.3false 0.1
– What are the evidence variables in the winter/snow/crash example?– What are hidden variables? Query variables?
i.e. not query or evidence
![Page 51: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/51.jpg)
Variable elimination: general procedure example
P(b|m,j) = ?
![Page 52: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/52.jpg)
Variable elimination: general procedure example
P(b|m,j) = ?
1. select evidence variables– P(m|A) P(j|A)
2. select variable ordering: A,E3. join on A
– P(m,j,A|B,E) = P(m|A) P(j|A) P(A|B,E)4. marginalize out A
– P(m,j|B,E) = \sum_A P(m,j,A|B,E)5. join on E
– P(m,j,E|B) = P(m,j|B,E) P(E)6. marginalize out E
– P(m,j|B) = \sum_E P(m,j,E|B)7. join on B
– P(m,j,B) = P(m,j|B)P(B)8. normalize on B
– P(B|m,j)
![Page 53: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/53.jpg)
Variable elimination: general procedure example
P(b|m,j) = ?Same example with equations:
![Page 54: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/54.jpg)
Another example
Calculate P(X_3|y_1,y_2,y_3)Use this variable ordering: X_1, X_2, Z
normalize
![Page 55: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/55.jpg)
Another example
Calculate P(X_3|y_1,y_2,y_3)Use this variable ordering: X_1, X_2, Z
normalize
What would this look like if we used a different ordering: Z, X_1, X_2?– why is ordering important?
![Page 56: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/56.jpg)
Another example
Calculate P(X_3|y_1,y_2,y_3)Use this variable ordering: X_1, X_2, Z
normalize
What would this look like if we used a different ordering: Z, X_1, X_2?– why is ordering important?
Ordering has a major impact on size of largest factor
– size 2^n vs size 2– an ordering w/ small factors might not exist for a given network– in worst case, inference is np-hard in the number of variables
– an efficient solution to inference would produce efficent sol'ns to 3SAT
![Page 57: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/57.jpg)
Polytrees
Polytree:
– bayes net w/ no undirected cycles– inference is simpler than the general case (why)?
– what is maximum factor size?– what is the complexity of inference?
Can you do cutset conditioning?
![Page 58: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/58.jpg)
Approximate Inference
Can't do exact inference in all situations (because of complexity)
Alternatives?
![Page 59: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/59.jpg)
Approximate Inference
Can't do exact inference in all situations (because of complexity)
Alternatives?
Yes: approximate inference
Basic idea: sample from the distribution and then evaluate distribution of interest
![Page 60: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/60.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Calculate P(Q|e_1,...,e_n)
![Page 61: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/61.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
Calculate P(Q|e_1,...,e_n)
![Page 62: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/62.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W
Calculate P(Q|e_1,...,e_n)
![Page 63: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/63.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1
Calculate P(Q|e_1,...,e_n)
![Page 64: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/64.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1
Calculate P(Q|e_1,...,e_n)
![Page 65: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/65.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0
Calculate P(Q|e_1,...,e_n)
![Page 66: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/66.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0, 1
Calculate P(Q|e_1,...,e_n)
![Page 67: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/67.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0, 11, 0, 1, 10, 1, 0, 11, 0, 1, 10, 0, 1, 1...
Calculate P(Q|e_1,...,e_n)
![Page 68: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/68.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0, 11, 0, 1, 10, 1, 0, 11, 0, 1, 10, 0, 1, 1...
P(W|C) = 3/3
P(R|S) = 0/2
P(W) = 5/5
Calculate P(Q|e_1,...,e_n)
![Page 69: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/69.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0, 11, 0, 1, 10, 1, 0, 11, 0, 1, 10, 0, 1, 1...
P(W|C) = 3/3
P(R|S) = 0/2
P(W) = 5/5
What are the strengths/weakness of this approach?
Calculate P(Q|e_1,...,e_n)
![Page 70: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/70.jpg)
Direct Sampling/Rejection Sampling
1. sort variables in topological order (partial order)2. starting with root, draw one sample for each variable, X_i, from P(X_i|parents(X_i))3. repeat step 2 n times and save the results4. induce distribution of interest from samples
Topological sort: C,S,R,W
C, S, R, W1, 1, 0, 11, 0, 1, 10, 1, 0, 11, 0, 1, 10, 0, 1, 1...
P(W|C) = 3/3
P(R|S) = 0/2
P(W) = 5/5
What are the strengths/weakness of this approach?– inference is easy– estimates are consistent (what does that mean?)– hard to get good estimates if evidence occurs rarely
Calculate P(Q|e_1,...,e_n)
![Page 71: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/71.jpg)
Likelihood weightingWhat if the evidence is unlikely?
– use likelihood weighting!
Idea: – only generate samples consistent w/ evidence– but weight that samples according to likelihood of evidence
in that scenario
![Page 72: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/72.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight 1
![Page 73: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/73.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0.5
![Page 74: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/74.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 0.5
![Page 75: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/75.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 1, 0.5
![Page 76: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/76.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 1, 1, 0.45
![Page 77: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/77.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 1, 1, 0.451, 1, 0, 1, 0.451, 1, 1, 1, 0.4951, 0, 0, 1, 01, 0, 1, 1, 0.45...
P(s|c,w) = 0.476/sum W
P(r|c,w) = 0.46/sum W
![Page 78: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/78.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 1, 1, 0.451, 1, 0, 1, 0.451, 1, 1, 1, 0.4951, 0, 0, 1, 01, 0, 1, 1, 0.45...
![Page 79: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/79.jpg)
Likelihood weighting
1. sort variables in topological order (partial order)2. init W = 13. set all evidence variables to their query values4. starting with root, draw one sample for each non-evidence variable:
X_i, from P(X_i|parents(X_i))5. as you encounter the evidence variables, W=W*P(e|samples)6. repeat steps 2--5 n times and save the results7. induce distribution of interest from weighted samples
Calculate P(Q|e_1,...,e_n)
Calculate: P(S,R|c,w)
C, S, R, W, weight1, 0, 1, 1, 0.451, 1, 0, 1, 0.451, 1, 1, 1, 0.4951, 0, 0, 1, 01, 0, 1, 1, 0.45...
P(s|c,w) = 0.476/sum W
P(r|c,w) = 0.46/sum W
![Page 80: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/80.jpg)
Bayes net example
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Is there a way to represent this distribution more compactly?
![Page 81: Bayes Networks - ccis.northeastern.edu fileBayes net example Cavity toothache catch Diagram encodes the fact that toothache is conditionally independent of catch given cavity – therefore,](https://reader030.fdocuments.in/reader030/viewer/2022040314/5e14d88f2bb3fb49c7553dca/html5/thumbnails/81.jpg)
Bayes net example
Cavity
toothache catch
cavity P(T,C)
true 0.16
false 0.048
P(T,!C)
0.018
0.19
P(!T,C)
0.018
0.11
P(!T,!C)
0.002
0.448
Is there a way to represent this distribution more compactly?
– does this diagram help?