SlideShare a Scribd company logo
1 of 21
CPS 170: Artificial Intelligence
http://www.cs.duke.edu/courses/spring09/cps170/
Bayesian networks
Instructor: Vincent Conitzer
Specifying probability distributions
• Specifying a probability for every atomic event is
impractical
• P(X1, …, Xn) would need to be specified for every
combination x1, …, xn of values for X1, …, Xn
– If there are k possible values per variable…
– … we need to specify kn - 1 probabilities!
• We have already seen it can be easier to specify probability
distributions by using (conditional) independence
• Bayesian networks allow us
– to specify any distribution,
– to specify such distributions concisely if there is
(conditional) independence, in a natural way
A general approach to specifying
probability distributions
• Say the variables are X1, …, Xn
• P(X1, …, Xn) = P(X1)P(X2|X1)P(X3|X1,X2)…P(Xn|X1, …, Xn-1)
• or:
• P(X1, …, Xn) = P(Xn)P(Xn-1|Xn)P(Xn-2|Xn,Xn-1)…P(X1|Xn, …, X2)
• Can specify every component
– For every combination of values for the variables on the right of |,
specify the probability over the values for the variable on the left
• If every variable can take k values,
• P(Xi|X1, …, Xi-1) requires (k-1)ki-1 values
• Σi={1,..,n}(k-1)ki-1 = Σi={1,..,n}ki-ki-1 = kn - 1
• Same as specifying probabilities of all atomic events – of
course, because we can specify any distribution!
Graphically representing influences
X1 X2
X3
X4
Conditional independence to
the rescue!
• Problem: P(Xi|X1, …, Xi-1) requires us to
specify too many values
• Suppose X1, …, Xi-1 partition into two
subsets, S and T, so that Xi is conditionally
independent from T given S
• P(Xi|X1, …, Xi-1) = P(Xi|S, T) = P(Xi|S)
• Requires only (k-1)k|S| values instead of (k-
1)ki-1 values
Graphically representing influences
X1 X2
X3
X4
• … if X4 is conditionally independent from X2
given X1 and X3
Rain and sprinklers example
raining (X) sprinklers (Y)
grass wet (Z)
P(Z=1 | X=0, Y=0) = .1
P(Z=1 | X=0, Y=1) = .8
P(Z=1 | X=1, Y=0) = .7
P(Z=1 | X=1, Y=1) = .9
P(X=1) = .3 P(Y=1) = .4
sprinklers is independent of raining, so no
edge between them
Each node has a
conditional
probability table
(CPT)
Rigged casino example
casino rigged
die 1 die 2
die 2 is conditionally independent of die 1 given
casino rigged, so no edge between them
P(CR=1) = 1/2
P(D1=1|CR=0) = 1/6
…
P(D1=5|CR=0) = 1/6
P(D1=1|CR=1) = 3/12
…
P(D1=5|CR=1) = 1/6
P(D2=1|CR=0) = 1/6
…
P(D2=5|CR=0) = 1/6
P(D2=1|CR=1) = 3/12
…
P(D2=5|CR=1) = 1/6
Rigged casino example with
poorly chosen order
casino rigged
die 1 die 2
die 1 and die 2 are not
independent
both the dice have relevant
information for whether the
casino is rigged need 36 probabilities here!
More elaborate rain and
sprinklers example
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Inference
• Want to know: P(+r|+d) = P(+r,+d)/P(+d)
• Let’s compute P(+r,+d)
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Inference…
• P(+r,+d)= ΣsΣgΣn P(+r)P(s)P(n|+r)P(g|+r,s)P(+d|n,g) =
P(+r)ΣsP(s)ΣgP(g|+r,s)Σn P(n|+r)P(+d|n,g)
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Variable elimination
• From the factor Σn P(n|+r)P(+d|n,g) we sum out n to obtain a factor only depending on g
• [Σn P(n|+r)P(+d|n,+g)] = P(+n|+r)P(+d|+n,+g) + P(-n|+r)P(+d|-n,+g) = .3*.9+.7*.5 = .62
• [Σn P(n|+r)P(+d|n,-g)] = P(+n|+r)P(+d|+n,-g) + P(-n|+r)P(+d|-n,-g) = .3*.4+.7*.3 = .33
• Continuing to the left, g will be summed out next, etc. (continued on board)
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Elimination order matters
• P(+r,+d)= ΣnΣsΣg P(+r)P(s)P(n|+r)P(g|+r,s)P(+d|n,g) =
P(+r)ΣnP(n|+r)ΣsP(s)Σg P(g|+r,s)P(+d|n,g)
• Last factor will depend on two variables in this case!
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Don’t always need to sum over all variables
• Can drop parts of the network that are irrelevant
• P(+r, +s) = P(+r)P(+s) = .6*.2 = .12
• P(+n, +s) = ΣrP(r, +n, +s) = ΣrP(r)P(+n|r)P(+s) = P(+s)ΣrP(r)P(+n|r) =
P(+s)(P(+r)P(+n|+r) + P(-r)P(+n|-r)) = .6*(.2*.3 + .8*.4) = .6*.38 = .228
• P(+d | +n, +g, +s) = P(+d | +n, +g) = .9
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
P(+r) = .2
P(+n|+r) = .3
P(+n|-r) = .4
P(+s) = .6
P(+g|+r,+s) = .9
P(+g|+r,-s) = .7
P(+g|-r,+s) = .8
P(+g|-r,-s) = .2
P(+d|+n,+g) = .9
P(+d|+n,-g) = .4
P(+d|-n,+g) = .5
P(+d|-n,-g) = .3
Trees are easy
• Choose an extreme variable to eliminate first
• Its probability is “absorbed” by its neighbor
• …Σx4
P(x4|x1,x2)…Σx5
P(x5|x4) = …Σx4
P(x4|x1,x2)[Σx5
P(x5|x4)]…
X1 X2 X3
X4
X6
X5
X7 X8
Clustering algorithms
• Merge nodes into “meganodes” until we have a tree
– Then, can apply special-purpose algorithm for trees
• Merged node has values {+n+g,+n-g,-n+g,-n-g}
– Much larger CPT
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
rained
sprinklers
were on
neighbor walked
dog, grass wet
dog wet
Logic gates in Bayes nets
• Not everything needs to be random…
X1 X2
Y P(+y|+x1,+x2) = 1
P(+y|-x1,+x2) = 0
P(+y|+x1,-x2) = 0
P(+y|-x1,-x2) = 0
X1 X2
Y P(+y|+x1,+x2) = 1
P(+y|-x1,+x2) = 1
P(+y|+x1,-x2) = 1
P(+y|-x1,-x2) = 0
AND gate OR gate
Modeling satisfiability as a Bayes Net
• (+X1 OR -X2) AND (-X1 OR -X2 OR -X3)
P(+c1|+x1,+x2) = 1
P(+c1|-x1,+x2) = 0
P(+c1|+x1,-x2) = 1
P(+c1|-x1,-x2) = 1
X1 X2 X3
C1 P(+y|+x1,+x2) = 0
P(+y|-x1,+x2) = 1
P(+y|+x1,-x2) = 1
P(+y|-x1,-x2) = 1
Y = -X1 OR -X2
C2
P(+c2|+y,+x3) = 1
P(+c2|-y,+x3) = 0
P(+c2|+y,-x3) = 1
P(+c2|-y,-x3) = 1
formula
P(+f|+c1,+c2) = 1
P(+f|-c1,+c2) = 0
P(+f|+c1,-c2) = 0
P(+f|-c1,-c2) = 0
P(+x1) = ½ P(+x2) = ½ P(+x3) = ½
• P(+f) > 0 iff formula is satisfiable, so inference is NP-hard
• P(+f) = (#satisfying assignments/2n), so inference is #P-hard
(because counting number of satisfying assignments is)
More about conditional independence
• A node is conditionally independent of its non-descendants, given its
parents
• A node is conditionally independent of everything else in the graph,
given its parents, children, and children’s parents (its Markov blanket)
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
• N is independent of G
given R
• N is not independent
of G given R and D
• N is independent of S
given R, G, D
Note: can’t know for sure that two
nodes are not independent: edges
may be dummy edges
General criterion: d-separation
• Sets of variables X and Y are conditionally independent given
variables in Z if all paths between X and Y are blocked; a path is
blocked if one of the following holds:
– it contains U -> V -> W or U <- V <- W or U <- V -> W, and V is in Z
– it contains U -> V <- W, and neither V nor any of its descendants are in Z
rained
sprinklers
were on
grass wet
dog wet
neighbor
walked dog
• N is independent of G
given R
• N is not independent
of S given R and D

More Related Content

Similar to cps170_bayes_nets.ppt

PROBABILITY DISTRIBUTION
PROBABILITY DISTRIBUTIONPROBABILITY DISTRIBUTION
PROBABILITY DISTRIBUTIONshahzadebaujiti
 
Re:ゲーム理論入門 - ナッシュ均衡の存在証明
Re:ゲーム理論入門 - ナッシュ均衡の存在証明Re:ゲーム理論入門 - ナッシュ均衡の存在証明
Re:ゲーム理論入門 - ナッシュ均衡の存在証明ssusere0a682
 
CS571: Language Models
CS571: Language ModelsCS571: Language Models
CS571: Language ModelsJinho Choi
 
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...polanesgumiran
 
Sbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSaidatina Khadijah
 
Aieee maths-quick review
Aieee maths-quick reviewAieee maths-quick review
Aieee maths-quick reviewSharath Kumar
 
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...Frank Nielsen
 
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihoodDeep Learning JP
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniquesKrishna Gali
 
Scattering theory analogues of several classical estimates in Fourier analysis
Scattering theory analogues of several classical estimates in Fourier analysisScattering theory analogues of several classical estimates in Fourier analysis
Scattering theory analogues of several classical estimates in Fourier analysisVjekoslavKovac1
 
A/B Testing for Game Design
A/B Testing for Game DesignA/B Testing for Game Design
A/B Testing for Game DesignTrieu Nguyen
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsGabriel Peyré
 
[2019] Language Modeling
[2019] Language Modeling[2019] Language Modeling
[2019] Language ModelingJinho Choi
 
15 Probability Distribution Practical (HSC).pdf
15 Probability Distribution Practical (HSC).pdf15 Probability Distribution Practical (HSC).pdf
15 Probability Distribution Practical (HSC).pdfvedantsk1
 

Similar to cps170_bayes_nets.ppt (20)

Dubey
DubeyDubey
Dubey
 
PROBABILITY DISTRIBUTION
PROBABILITY DISTRIBUTIONPROBABILITY DISTRIBUTION
PROBABILITY DISTRIBUTION
 
Re:ゲーム理論入門 - ナッシュ均衡の存在証明
Re:ゲーム理論入門 - ナッシュ均衡の存在証明Re:ゲーム理論入門 - ナッシュ均衡の存在証明
Re:ゲーム理論入門 - ナッシュ均衡の存在証明
 
CS571: Language Models
CS571: Language ModelsCS571: Language Models
CS571: Language Models
 
Interpolation
InterpolationInterpolation
Interpolation
 
Maths04
Maths04Maths04
Maths04
 
Factor theorem
Factor theoremFactor theorem
Factor theorem
 
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...
Delos-Santos-Analyn-M.-_Repoter-No.-1-Multiplication-and-Division-of-Polynomi...
 
Sbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSbma 4603 numerical methods Assignment
Sbma 4603 numerical methods Assignment
 
Aieee maths-quick review
Aieee maths-quick reviewAieee maths-quick review
Aieee maths-quick review
 
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...
Slides: Total Jensen divergences: Definition, Properties and k-Means++ Cluste...
 
Maths05
Maths05Maths05
Maths05
 
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood
【DL輪読会】Unbiased Gradient Estimation for Marginal Log-likelihood
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
 
stoch41.pdf
stoch41.pdfstoch41.pdf
stoch41.pdf
 
Scattering theory analogues of several classical estimates in Fourier analysis
Scattering theory analogues of several classical estimates in Fourier analysisScattering theory analogues of several classical estimates in Fourier analysis
Scattering theory analogues of several classical estimates in Fourier analysis
 
A/B Testing for Game Design
A/B Testing for Game DesignA/B Testing for Game Design
A/B Testing for Game Design
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse Problems
 
[2019] Language Modeling
[2019] Language Modeling[2019] Language Modeling
[2019] Language Modeling
 
15 Probability Distribution Practical (HSC).pdf
15 Probability Distribution Practical (HSC).pdf15 Probability Distribution Practical (HSC).pdf
15 Probability Distribution Practical (HSC).pdf
 

Recently uploaded

20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxBoston Institute of Analytics
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一F La
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一F La
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理e4aez8ss
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 

Recently uploaded (20)

20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 

cps170_bayes_nets.ppt

  • 1. CPS 170: Artificial Intelligence http://www.cs.duke.edu/courses/spring09/cps170/ Bayesian networks Instructor: Vincent Conitzer
  • 2. Specifying probability distributions • Specifying a probability for every atomic event is impractical • P(X1, …, Xn) would need to be specified for every combination x1, …, xn of values for X1, …, Xn – If there are k possible values per variable… – … we need to specify kn - 1 probabilities! • We have already seen it can be easier to specify probability distributions by using (conditional) independence • Bayesian networks allow us – to specify any distribution, – to specify such distributions concisely if there is (conditional) independence, in a natural way
  • 3. A general approach to specifying probability distributions • Say the variables are X1, …, Xn • P(X1, …, Xn) = P(X1)P(X2|X1)P(X3|X1,X2)…P(Xn|X1, …, Xn-1) • or: • P(X1, …, Xn) = P(Xn)P(Xn-1|Xn)P(Xn-2|Xn,Xn-1)…P(X1|Xn, …, X2) • Can specify every component – For every combination of values for the variables on the right of |, specify the probability over the values for the variable on the left • If every variable can take k values, • P(Xi|X1, …, Xi-1) requires (k-1)ki-1 values • Σi={1,..,n}(k-1)ki-1 = Σi={1,..,n}ki-ki-1 = kn - 1 • Same as specifying probabilities of all atomic events – of course, because we can specify any distribution!
  • 5. Conditional independence to the rescue! • Problem: P(Xi|X1, …, Xi-1) requires us to specify too many values • Suppose X1, …, Xi-1 partition into two subsets, S and T, so that Xi is conditionally independent from T given S • P(Xi|X1, …, Xi-1) = P(Xi|S, T) = P(Xi|S) • Requires only (k-1)k|S| values instead of (k- 1)ki-1 values
  • 6. Graphically representing influences X1 X2 X3 X4 • … if X4 is conditionally independent from X2 given X1 and X3
  • 7. Rain and sprinklers example raining (X) sprinklers (Y) grass wet (Z) P(Z=1 | X=0, Y=0) = .1 P(Z=1 | X=0, Y=1) = .8 P(Z=1 | X=1, Y=0) = .7 P(Z=1 | X=1, Y=1) = .9 P(X=1) = .3 P(Y=1) = .4 sprinklers is independent of raining, so no edge between them Each node has a conditional probability table (CPT)
  • 8. Rigged casino example casino rigged die 1 die 2 die 2 is conditionally independent of die 1 given casino rigged, so no edge between them P(CR=1) = 1/2 P(D1=1|CR=0) = 1/6 … P(D1=5|CR=0) = 1/6 P(D1=1|CR=1) = 3/12 … P(D1=5|CR=1) = 1/6 P(D2=1|CR=0) = 1/6 … P(D2=5|CR=0) = 1/6 P(D2=1|CR=1) = 3/12 … P(D2=5|CR=1) = 1/6
  • 9. Rigged casino example with poorly chosen order casino rigged die 1 die 2 die 1 and die 2 are not independent both the dice have relevant information for whether the casino is rigged need 36 probabilities here!
  • 10. More elaborate rain and sprinklers example rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 11. Inference • Want to know: P(+r|+d) = P(+r,+d)/P(+d) • Let’s compute P(+r,+d) rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 12. Inference… • P(+r,+d)= ΣsΣgΣn P(+r)P(s)P(n|+r)P(g|+r,s)P(+d|n,g) = P(+r)ΣsP(s)ΣgP(g|+r,s)Σn P(n|+r)P(+d|n,g) rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 13. Variable elimination • From the factor Σn P(n|+r)P(+d|n,g) we sum out n to obtain a factor only depending on g • [Σn P(n|+r)P(+d|n,+g)] = P(+n|+r)P(+d|+n,+g) + P(-n|+r)P(+d|-n,+g) = .3*.9+.7*.5 = .62 • [Σn P(n|+r)P(+d|n,-g)] = P(+n|+r)P(+d|+n,-g) + P(-n|+r)P(+d|-n,-g) = .3*.4+.7*.3 = .33 • Continuing to the left, g will be summed out next, etc. (continued on board) rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 14. Elimination order matters • P(+r,+d)= ΣnΣsΣg P(+r)P(s)P(n|+r)P(g|+r,s)P(+d|n,g) = P(+r)ΣnP(n|+r)ΣsP(s)Σg P(g|+r,s)P(+d|n,g) • Last factor will depend on two variables in this case! rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 15. Don’t always need to sum over all variables • Can drop parts of the network that are irrelevant • P(+r, +s) = P(+r)P(+s) = .6*.2 = .12 • P(+n, +s) = ΣrP(r, +n, +s) = ΣrP(r)P(+n|r)P(+s) = P(+s)ΣrP(r)P(+n|r) = P(+s)(P(+r)P(+n|+r) + P(-r)P(+n|-r)) = .6*(.2*.3 + .8*.4) = .6*.38 = .228 • P(+d | +n, +g, +s) = P(+d | +n, +g) = .9 rained sprinklers were on grass wet dog wet neighbor walked dog P(+r) = .2 P(+n|+r) = .3 P(+n|-r) = .4 P(+s) = .6 P(+g|+r,+s) = .9 P(+g|+r,-s) = .7 P(+g|-r,+s) = .8 P(+g|-r,-s) = .2 P(+d|+n,+g) = .9 P(+d|+n,-g) = .4 P(+d|-n,+g) = .5 P(+d|-n,-g) = .3
  • 16. Trees are easy • Choose an extreme variable to eliminate first • Its probability is “absorbed” by its neighbor • …Σx4 P(x4|x1,x2)…Σx5 P(x5|x4) = …Σx4 P(x4|x1,x2)[Σx5 P(x5|x4)]… X1 X2 X3 X4 X6 X5 X7 X8
  • 17. Clustering algorithms • Merge nodes into “meganodes” until we have a tree – Then, can apply special-purpose algorithm for trees • Merged node has values {+n+g,+n-g,-n+g,-n-g} – Much larger CPT rained sprinklers were on grass wet dog wet neighbor walked dog rained sprinklers were on neighbor walked dog, grass wet dog wet
  • 18. Logic gates in Bayes nets • Not everything needs to be random… X1 X2 Y P(+y|+x1,+x2) = 1 P(+y|-x1,+x2) = 0 P(+y|+x1,-x2) = 0 P(+y|-x1,-x2) = 0 X1 X2 Y P(+y|+x1,+x2) = 1 P(+y|-x1,+x2) = 1 P(+y|+x1,-x2) = 1 P(+y|-x1,-x2) = 0 AND gate OR gate
  • 19. Modeling satisfiability as a Bayes Net • (+X1 OR -X2) AND (-X1 OR -X2 OR -X3) P(+c1|+x1,+x2) = 1 P(+c1|-x1,+x2) = 0 P(+c1|+x1,-x2) = 1 P(+c1|-x1,-x2) = 1 X1 X2 X3 C1 P(+y|+x1,+x2) = 0 P(+y|-x1,+x2) = 1 P(+y|+x1,-x2) = 1 P(+y|-x1,-x2) = 1 Y = -X1 OR -X2 C2 P(+c2|+y,+x3) = 1 P(+c2|-y,+x3) = 0 P(+c2|+y,-x3) = 1 P(+c2|-y,-x3) = 1 formula P(+f|+c1,+c2) = 1 P(+f|-c1,+c2) = 0 P(+f|+c1,-c2) = 0 P(+f|-c1,-c2) = 0 P(+x1) = ½ P(+x2) = ½ P(+x3) = ½ • P(+f) > 0 iff formula is satisfiable, so inference is NP-hard • P(+f) = (#satisfying assignments/2n), so inference is #P-hard (because counting number of satisfying assignments is)
  • 20. More about conditional independence • A node is conditionally independent of its non-descendants, given its parents • A node is conditionally independent of everything else in the graph, given its parents, children, and children’s parents (its Markov blanket) rained sprinklers were on grass wet dog wet neighbor walked dog • N is independent of G given R • N is not independent of G given R and D • N is independent of S given R, G, D Note: can’t know for sure that two nodes are not independent: edges may be dummy edges
  • 21. General criterion: d-separation • Sets of variables X and Y are conditionally independent given variables in Z if all paths between X and Y are blocked; a path is blocked if one of the following holds: – it contains U -> V -> W or U <- V <- W or U <- V -> W, and V is in Z – it contains U -> V <- W, and neither V nor any of its descendants are in Z rained sprinklers were on grass wet dog wet neighbor walked dog • N is independent of G given R • N is not independent of S given R and D