SlideShare a Scribd company logo
Bayesian Belief Networks in R
Abraham Mathew
Carmichael Lynch
Dataˆ3 2015
March 5, 2015
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 1 / 11
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 2 / 11
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 3 / 11
Review of Probability Theory
Sample space: The set of all possible events of an experiment
Marginal probability: the probability of an event occurring, or
P(A)
Conditional probability: the probability of event A occurring
given that event B occurs, or P(A|B)
Joint probability: the probability of event A and event B
occurring, or P(AandB)
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 4 / 11
Probabilistic Graphical Models
Probabilistic graphical models represent the conditional
dependencies between random variables through a graph
structure.
Nodes correspond to random variables and edges represent
statistical dependencies between the variables.
Bayesian Belief Networks (directed acyclic graphics) and Markov
Network (undirected).
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 5 / 11
Bayesian Belief Networks
Goal: learn the structure of a network and learn the parameters.
This is a directed acyclic graphic (DAG) that shows the
dependencies between the variables.
The relationship between shared interests and liked you is
dependent on the number of pictures.
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 6 / 11
Bayesian Belief Networks
P(LY |P), or what is the probability that a user liked you, given
the number of pictures on their profile?
Each node is associated with a probability function that specifies
the probability of that variable conditional on the parent node.
Pictures
Liked_You 3 4 5 6
N 0.1666667 0.6363636 0.5384615 0.7500000
Y 0.8333333 0.3636364 0.4615385 0.2500000
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 7 / 11
BNLEARN Package
bnlearn package (CRAN)
The package implements a number of constraint based, pairwise,
score-based, and hybrid structure learning algorithms.
For the Tinder data set, use a score-based algorithm to learn the
network structure.
library(bnlearn)
net <- hc(dat)
plot(net)
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 8 / 11
BNLEARN Package
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 9 / 11
BNLEARN Package
## HIGHLIGHT NODE AND ITS MARKOV BLANKET
plot(net, highlight = c("Pictures",
mb(net, "Pictures")))
## ESTIMATE PARAMETERS
fitted <- bn.fit(net, dat)
fitted
## STRENGTH OF THE ARCS
arc.strength(net, dat)
## CONDITIONAL PROBABILITY QUERIES
cpquery(fitted, (Liked_You=="Y"), TRUE)
cpquery(fitted, (Liked_You=="N"),
(Pictures=="3" & Text=="N"))
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 10 / 11
Further Reading
Ross, Sheldon. Introduction to Probability Models
Scutari, Marco. Bayesian Networks: With Examples in R
Nagarajan, Radhakrishnan, Scutari, Marco, and L`ebre, Sophie.
Bayesian Networks in R: with Applications in Systems Biology
Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 11 / 11

More Related Content

Similar to Bn presentation

Analysis of massive data using R (CAEPIA2015)
Analysis of massive data using R (CAEPIA2015)Analysis of massive data using R (CAEPIA2015)
Analysis of massive data using R (CAEPIA2015)
AMIDST Toolbox
 
fraudulent Insurance claims detection using ML
fraudulent Insurance claims detection using MLfraudulent Insurance claims detection using ML
fraudulent Insurance claims detection using ML
Babu Pallam
 
Cost optimized reliability test planning rev 7
Cost optimized reliability test planning rev 7Cost optimized reliability test planning rev 7
Cost optimized reliability test planning rev 7
ASQ Reliability Division
 
Power Law Distributions for Twitter Data
Power Law Distributions for Twitter DataPower Law Distributions for Twitter Data
Power Law Distributions for Twitter Data
Conor Feeney
 
Bayesian Network Modeling using Python and R
Bayesian Network Modeling using Python and RBayesian Network Modeling using Python and R
Bayesian Network Modeling using Python and R
PyData
 
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and RPyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
Pragyansmita Nayak, Ph.D.
 

Similar to Bn presentation (6)

Analysis of massive data using R (CAEPIA2015)
Analysis of massive data using R (CAEPIA2015)Analysis of massive data using R (CAEPIA2015)
Analysis of massive data using R (CAEPIA2015)
 
fraudulent Insurance claims detection using ML
fraudulent Insurance claims detection using MLfraudulent Insurance claims detection using ML
fraudulent Insurance claims detection using ML
 
Cost optimized reliability test planning rev 7
Cost optimized reliability test planning rev 7Cost optimized reliability test planning rev 7
Cost optimized reliability test planning rev 7
 
Power Law Distributions for Twitter Data
Power Law Distributions for Twitter DataPower Law Distributions for Twitter Data
Power Law Distributions for Twitter Data
 
Bayesian Network Modeling using Python and R
Bayesian Network Modeling using Python and RBayesian Network Modeling using Python and R
Bayesian Network Modeling using Python and R
 
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and RPyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
PyData DC 2016 Talk: Bayesian Network Modeling Using Python and R
 

Recently uploaded

一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
Alireza Kamrani
 
Digital Marketing Performance Marketing Sample .pdf
Digital Marketing Performance Marketing  Sample .pdfDigital Marketing Performance Marketing  Sample .pdf
Digital Marketing Performance Marketing Sample .pdf
Vineet
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
Vineet
 
CAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdfCAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdf
frp60658
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
ugydym
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
9gr6pty
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
hqfek
 
一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理
keesa2
 
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
agdhot
 
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
PsychoTech Services
 
Q4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slideQ4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slide
mukulupadhayay1
 
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
oaxefes
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
blueshagoo1
 
A gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented GenerationA gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented Generation
dataschool1
 
SAP BW4HANA Implementagtion Content Document
SAP BW4HANA Implementagtion Content DocumentSAP BW4HANA Implementagtion Content Document
SAP BW4HANA Implementagtion Content Document
newdirectionconsulta
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
zsafxbf
 
06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus
Timothy Spann
 

Recently uploaded (20)

一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
 
Digital Marketing Performance Marketing Sample .pdf
Digital Marketing Performance Marketing  Sample .pdfDigital Marketing Performance Marketing  Sample .pdf
Digital Marketing Performance Marketing Sample .pdf
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
 
CAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdfCAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdf
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
 
一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理
 
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
 
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
 
Q4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slideQ4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slide
 
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
一比一原版卡尔加里大学毕业证(uc毕业证)如何办理
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
 
A gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented GenerationA gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented Generation
 
SAP BW4HANA Implementagtion Content Document
SAP BW4HANA Implementagtion Content DocumentSAP BW4HANA Implementagtion Content Document
SAP BW4HANA Implementagtion Content Document
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
 
06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus
 

Bn presentation

  • 1. Bayesian Belief Networks in R Abraham Mathew Carmichael Lynch Dataˆ3 2015 March 5, 2015 Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 1 / 11
  • 2. Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 2 / 11
  • 3. Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 3 / 11
  • 4. Review of Probability Theory Sample space: The set of all possible events of an experiment Marginal probability: the probability of an event occurring, or P(A) Conditional probability: the probability of event A occurring given that event B occurs, or P(A|B) Joint probability: the probability of event A and event B occurring, or P(AandB) Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 4 / 11
  • 5. Probabilistic Graphical Models Probabilistic graphical models represent the conditional dependencies between random variables through a graph structure. Nodes correspond to random variables and edges represent statistical dependencies between the variables. Bayesian Belief Networks (directed acyclic graphics) and Markov Network (undirected). Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 5 / 11
  • 6. Bayesian Belief Networks Goal: learn the structure of a network and learn the parameters. This is a directed acyclic graphic (DAG) that shows the dependencies between the variables. The relationship between shared interests and liked you is dependent on the number of pictures. Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 6 / 11
  • 7. Bayesian Belief Networks P(LY |P), or what is the probability that a user liked you, given the number of pictures on their profile? Each node is associated with a probability function that specifies the probability of that variable conditional on the parent node. Pictures Liked_You 3 4 5 6 N 0.1666667 0.6363636 0.5384615 0.7500000 Y 0.8333333 0.3636364 0.4615385 0.2500000 Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 7 / 11
  • 8. BNLEARN Package bnlearn package (CRAN) The package implements a number of constraint based, pairwise, score-based, and hybrid structure learning algorithms. For the Tinder data set, use a score-based algorithm to learn the network structure. library(bnlearn) net <- hc(dat) plot(net) Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 8 / 11
  • 9. BNLEARN Package Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 9 / 11
  • 10. BNLEARN Package ## HIGHLIGHT NODE AND ITS MARKOV BLANKET plot(net, highlight = c("Pictures", mb(net, "Pictures"))) ## ESTIMATE PARAMETERS fitted <- bn.fit(net, dat) fitted ## STRENGTH OF THE ARCS arc.strength(net, dat) ## CONDITIONAL PROBABILITY QUERIES cpquery(fitted, (Liked_You=="Y"), TRUE) cpquery(fitted, (Liked_You=="N"), (Pictures=="3" & Text=="N")) Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 10 / 11
  • 11. Further Reading Ross, Sheldon. Introduction to Probability Models Scutari, Marco. Bayesian Networks: With Examples in R Nagarajan, Radhakrishnan, Scutari, Marco, and L`ebre, Sophie. Bayesian Networks in R: with Applications in Systems Biology Abraham Mathew (Carmichael Lynch) Bayesian Belief Networks in R Dataˆ3 2015 March 5, 2015 11 / 11