SlideShare a Scribd company logo
1 of 41
Download to read offline
Bayesian Networks
Massimiliano Patacchiola, PhD Student in Cognitive Robotics
Centre for Robotics and Neural Systems , Plymouth University
1
Introduction
What are Bayesian Networks?
2
What is a Bayesian network?
“A Bayesian Network (BN) is a probabilistic graphical model that
represents a set of random variables and their conditional
dependencies via a directed acyclic graph.” [Wikipedia]
It enormously simplified the representation of probabilistic
relationships between random variables.
3
What is a Bayesian network?
The nodes represent random
variables. The edges represent causal
relationships.
Bad weather cause traffic jam (not the
opposite).
Inference: given the presence of traffic
jam it is possible to estimate the
probability of bad weather
4
Probability Theory
The backbone of Bayesian Networks
5
Random Variable
A random variable is defined as a function that maps probability to a physical
outcome (labels). The possible outcome when tossing a coin are two, we can
call these events [0, 1]. The probability of 0 is ½, the probability of 1 is ½.
6
Random Variable
What’s the probability of obtaining 3 rolling a fair dice?
We have a total of 6 possible outcomes: [1, 2, 3, 4, 5, 6]
The possibility of having 3 is ⅙
If we call X our random variable representing all these outcomes, we can say
that: pX
(3) = ⅙
7
Random Variable
Rolling a pair of dices what’s the probability of having 4 and 5? The
probability is 2/36 because we have 36 possible outcomes when rolling two
dices and the event we are looking for can happen in two way (4,5) and (5,4).
8
Random Variable
What’s the probability that the sum of the dices is 4? The probability is 3/36
because we can obtain that sum in three ways:
9
Probability Mass Function
Suppose that X: S → A is a discrete random variable defined on a sample
space S. Then the probability mass function fX
: A → [0, 1] for X is defined
as:
10
Expected Value
Suppose random variable X can take value x1
with probability p1
, value x2
with
probability p2
, and so on, up to value xk
with probability pk
. Then the
expectation of this random variable X is defined as:
11
Let X represent the outcome of a roll of a fair six-sided die. The possible
values for X are 1, 2, 3, 4, 5, and 6, all equally likely (each having the
probability of 1/6). The expectation of X is
Joint Probability
The probability that two (or more) events happen at the same time:
12
Only if the events are independent.
Two events are independent if the occurrence of one does not affect the
probability of occurrence of other.
Similarly, two random variables are independent if the realization of
one does not affect the probability distribution of the other.
Joint Probability
13
Rolling a dice twice:
the first value is an odd number
AND
the second value is less than four
P(A) = 3/6
P(B) = 3/6
P(A,B) = P(A) * P(B) = 9/36
Conditional Probability
14
Bayes Theorem
The probability of an event, based on prior knowledge of conditions that might
be related to the event:
15
- P(A) and P(B) are the probabilities of observing A and B without
regard to each other.
- P(A | B), a conditional probability, is the probability of observing event
A given that B is true.
- P(B | A) is the probability of observing event B given that A is true.
Bayes Theorem
16
Bayesian Network
Design
How to design a Bayesian Network?
17
Tools for Bayesian Networks
18
GeNIe C++ Linux, Mac, Windows
JavaBayes Java Linux, Mac, Windows
Stan R, Python, shell, MATLAB Linux, Mac, Windows
Dlib C++, Python Linux, Mac, Windows
Tools for Bayesian Networks
19
Installing GeNIe: https://www.bayesfusion.com
Spam Classifier (Naive Bayes)
Why naive? We assume independence between each pair of features. This
assumption could not be true, but for practical applications it works very well.
20
Spam Classifier (Naive Bayes)
Applying the Bayes theorem:
21
Then applying the Naive assumption we get:
The denominator is constant we can estimate the value of y as:
Spam Classifier (Naive Bayes)
Feature Prior Distributions: using a corpus of emails classified as spam and
ham estimating the frequency of each word. P(Money | Spam) = 0.8
Parent Prior Distribution: we assume there is no a priori reason for any
incoming message to be spam rather than ham (both cases have equal
probability). P(Spam)=0.5; P(Ham)=0.5
Inference: Given the words present in the incoming email estimate if the
email is spam or ham.
22
Spam Classifier (Naive Bayes)
“Dear Huda. Well, another year has passed. I just can't believe that it went so quickly. I've been
studying for my exams and I finished high school. Now I start my studies in the College of Medicine
and I really miss the times that we spent together. I am so sorry because I didn't send letters for
you. Actually, I lost your address and I was lucky to find it again. And how are you? I hope that you
and your family are all right. Did you join the Interior Design College as you always wished? I really
want to know your latest news and know everything about your studies. I'm writing to tell you that I
have been to Europe and it was great. Do you believe that I met our friend Yara in France? It was
by accident. She has been there for five years. Well, that's all about me and we're all doing fine
here. I hope to hear from you soon. Take care! Your best friend“
23
Spam Classifier (Naive Bayes)
“YES, GUARANTEED!!!! WE GUARANTEE THAT YOUR TEETH WILL BE BETWEEN 3 to 8
SHADES WHITER WITHIN THE NEXT 30 DAYS OR LESS OR YOUR MONEY BACK IN FULL.
THIS IS HOW CONFIDENT WE ARE ABOUT THIS PRODUCT. NO ONE ELSE WILL OFFER
YOU THIS. Take advantage as you have nothing to risk because of our money back guarantee.
Buy for yourselves, your family and your friends. They'll thank you for this. Makes a wonderful
Christmas gift! REMEMBER OUR SPECIAL: If you buy 2 kits, SHIPPING IS FREE. Buy 3 kits and
get the 4th FREE! To order this professional-grade teeth whitening system for the superlow price of
only $24.99, click on the link below to pay with a Visa or Mastercard.”
24
The alarm example
The alarm of my house can be activated by a burglary or by an earthquake.
When it is activated I can receive a call by John or by Mary.
25
The alarm example
I will use GeNIe to replicate this example. First of all let’s create the five nodes
using the yellow icon in the toolbar.
26
The alarm example
Selecting a node it is possible to modify the probability distributions and the
conditional probability tables. The Alarm node has a table with 8 entries,
given by all the possible combinations of the parents.
27
The alarm example
To enable bar chart view:
Right Click on Node > View As >
Bar Chart
To estimate the posterior
distribution:
press the update icon
28
The alarm example
Let’s suppose we know there has
been an earthquake while we
were in the office. What’s the
probability the alarm has been
activated?
Right Click on Earthquake node >
Set evidence > True
Press the update icon
29
The alarm example
Let’s suppose we receive a call
from Mary. What’s the probability
the alarm is active?
Clear previous evidence
Right Click on Mary node > Set
evidence > True
Press the update icon
30
Inference (Bayes Theorem)
The alarm example
The parent nodes Burglary and
Earthquake are independent.
The information that an
earthquake occurred does not
give us any hint about the
occurrence of a burglary, but…
If the alarm is active (evidence)
the two nodes become
dependent. In this case the
occurrence of an Earthquake
change the probability of a
burglary (and vice versa).
31
Case Studies
How are Bayesian Networks
used?
32
Case Study: Medical Diagnosis
Expert systems built with the help of doctors and with statistical record.
Each disease has some symptoms. Using a Bayesian network we can infer
the probability of a certain disease given the presence of specific symptoms.
33
Differential diagnostic tools, like DXPlain, use the Bayesian
inference decision process to take into account symptom or
lab result and then calculate the statistical probabilities of
various diagnoses.
By combining attributes from the patient’s file with clinical
expertise, external data, Watson for Oncology identifies
potential treatment plans for a patient.
Case Study: Medical Diagnosis
34
Case Study: Medical Diagnosis
35
Quiz: Do you remember the definition of independence of two random
variables?
Having a cold and having lung disease are a priori independent both
causally and statistically. But because they are both causes of coughing if we
observe cough (evidence) then cold and lung-disease become statistically
dependent.
Case Study: Fault Diagnosis
36
It is possible to build a bayesian network which describes the correlations
between a system behaviour and possible faults. For example, pressure
tank system, a system that discharges fluid from a reservoir into a pressure
tank with a control system that regulates the operation of the pump
Case Study: Fault Diagnosis
37
The top event considered is Pressure
Tank Overfilled and the component
failure modes are:
PRS Pressure switch fails to open
K2 Relay K2 contacts fail closed
K1 Relay K1 contacts fail closed
TIM Timer relay fails to timeout
S1 Switch contacts fails closed
Case Study: Cognitive Process Modelling
38
“Developmental Bayesian Model of Trust in Artificial Cognitive Systems.”
Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016.
Developmental Robotics: starting from children’s mental processes find
mechanism to use in robotics. Replicating children’s mental processes it is
possible to understand how human brain works.
Bayesian Networks: can describe the mental process of children dealing
with the estimation of the reliability of informants.
Case Study: Cognitive Process Modelling
39
“Developmental Bayesian Model of Trust in Artificial Cognitive Systems.”
Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016.
- Two informants, one reliable and one unreliable.
- The reliable informant suggests to the child the correct label for known
objects. The unreliable suggests incorrect labels for known objects.
- Unknown objects are presented to the child. The reliable informant
suggests a label, the unreliable suggests another label.
- Results: 3-years-old children do not differentiate between the two
informant, whereas the 4-years-old can discriminate.
Case Study: Cognitive Process Modelling
40
“Developmental Bayesian Model of Trust in Artificial Cognitive Systems.”
Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016.
The actions of the child are influenced by the child’s belief and the
informant’s action.
Thank you
Email: massimiliano.patacchiola@plymouth.ac.uk
Github: mpatacchiola
41

More Related Content

What's hot

Classification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsClassification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsMd. Main Uddin Rony
 
Stochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxStochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxShubham Jaybhaye
 
Naive bayes
Naive bayesNaive bayes
Naive bayesumeskath
 
Instance Based Learning in Machine Learning
Instance Based Learning in Machine LearningInstance Based Learning in Machine Learning
Instance Based Learning in Machine LearningPavithra Thippanaik
 
Bayesian networks in AI
Bayesian networks in AIBayesian networks in AI
Bayesian networks in AIByoung-Hee Kim
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learningHaris Jamil
 
NAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERNAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERKnoldus Inc.
 
Belief Networks & Bayesian Classification
Belief Networks & Bayesian ClassificationBelief Networks & Bayesian Classification
Belief Networks & Bayesian ClassificationAdnan Masood
 
Data Mining: Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...
Data Mining:  Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...Data Mining:  Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...
Data Mining: Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...Salah Amean
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision treesKnoldus Inc.
 
Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3DigiGurukul
 
Probabilistic Reasoning
Probabilistic ReasoningProbabilistic Reasoning
Probabilistic ReasoningJunya Tanaka
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & ReasoningSajid Marwat
 

What's hot (20)

Classification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsClassification Based Machine Learning Algorithms
Classification Based Machine Learning Algorithms
 
Stochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxStochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptx
 
Naive bayes
Naive bayesNaive bayes
Naive bayes
 
Bayes Belief Networks
Bayes Belief NetworksBayes Belief Networks
Bayes Belief Networks
 
Instance Based Learning in Machine Learning
Instance Based Learning in Machine LearningInstance Based Learning in Machine Learning
Instance Based Learning in Machine Learning
 
AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)AI Lecture 7 (uncertainty)
AI Lecture 7 (uncertainty)
 
Bayesian networks in AI
Bayesian networks in AIBayesian networks in AI
Bayesian networks in AI
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learning
 
NAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERNAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIER
 
AI: Logic in AI
AI: Logic in AIAI: Logic in AI
AI: Logic in AI
 
Belief Networks & Bayesian Classification
Belief Networks & Bayesian ClassificationBelief Networks & Bayesian Classification
Belief Networks & Bayesian Classification
 
Data Mining: Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...
Data Mining:  Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...Data Mining:  Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...
Data Mining: Concepts and Techniques_ Chapter 6: Mining Frequent Patterns, ...
 
Bayesian learning
Bayesian learningBayesian learning
Bayesian learning
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision trees
 
Artificial Neural Networks for Data Mining
Artificial Neural Networks for Data MiningArtificial Neural Networks for Data Mining
Artificial Neural Networks for Data Mining
 
Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3
 
Probabilistic Reasoning
Probabilistic ReasoningProbabilistic Reasoning
Probabilistic Reasoning
 
Bayesian network
Bayesian networkBayesian network
Bayesian network
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Knowledge Representation & Reasoning
Knowledge Representation & ReasoningKnowledge Representation & Reasoning
Knowledge Representation & Reasoning
 

Similar to Bayesian networks

Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...
Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...
Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...Bayesia USA
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributionsRajaKrishnan M
 
Module-2_Notes-with-Example for data science
Module-2_Notes-with-Example for data scienceModule-2_Notes-with-Example for data science
Module-2_Notes-with-Example for data sciencepujashri1975
 
Simplicial closure and higher-order link prediction
Simplicial closure and higher-order link predictionSimplicial closure and higher-order link prediction
Simplicial closure and higher-order link predictionAustin Benson
 
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...Madhav Mishra
 
Advanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxAdvanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxakashayosha
 
Using model-based statistical inference to learn about evolution
Using model-based statistical inference to learn about evolutionUsing model-based statistical inference to learn about evolution
Using model-based statistical inference to learn about evolutionErick Matsen
 
Mncs 16-09-4주-변승규-introduction to the machine learning
Mncs 16-09-4주-변승규-introduction to the machine learningMncs 16-09-4주-변승규-introduction to the machine learning
Mncs 16-09-4주-변승규-introduction to the machine learningSeung-gyu Byeon
 
Knowledge And Patterns
Knowledge And PatternsKnowledge And Patterns
Knowledge And PatternsDavid Wilson
 
08 Inference for Networks – DYAD Model Overview (2017)
08 Inference for Networks – DYAD Model Overview (2017)08 Inference for Networks – DYAD Model Overview (2017)
08 Inference for Networks – DYAD Model Overview (2017)Duke Network Analysis Center
 
10 Must-Know Statistical Concepts for Data Scientists.docx
10 Must-Know Statistical Concepts for Data Scientists.docx10 Must-Know Statistical Concepts for Data Scientists.docx
10 Must-Know Statistical Concepts for Data Scientists.docxKin Kan
 
Simplicial closure & higher-order link prediction
Simplicial closure & higher-order link predictionSimplicial closure & higher-order link prediction
Simplicial closure & higher-order link predictionAustin Benson
 
Frequentist inference only seems easy By John Mount
Frequentist inference only seems easy By John MountFrequentist inference only seems easy By John Mount
Frequentist inference only seems easy By John MountChester Chen
 
Simplicial closure and higher-order link prediction (SIAMNS18)
Simplicial closure and higher-order link prediction (SIAMNS18)Simplicial closure and higher-order link prediction (SIAMNS18)
Simplicial closure and higher-order link prediction (SIAMNS18)Austin Benson
 
BA4101 Question Bank.pdf
BA4101 Question Bank.pdfBA4101 Question Bank.pdf
BA4101 Question Bank.pdfFredrickWilson4
 

Similar to Bayesian networks (20)

Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...
Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...
Paradoxes and Fallacies - Resolving some well-known puzzles with Bayesian net...
 
Different types of distributions
Different types of distributionsDifferent types of distributions
Different types of distributions
 
Module-2_Notes-with-Example for data science
Module-2_Notes-with-Example for data scienceModule-2_Notes-with-Example for data science
Module-2_Notes-with-Example for data science
 
Simplicial closure and higher-order link prediction
Simplicial closure and higher-order link predictionSimplicial closure and higher-order link prediction
Simplicial closure and higher-order link prediction
 
226 lec9 jda
226 lec9 jda226 lec9 jda
226 lec9 jda
 
Bayesian statistics
Bayesian statisticsBayesian statistics
Bayesian statistics
 
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...
Applied Artificial Intelligence Unit 2 Semester 3 MSc IT Part 2 Mumbai Univer...
 
Chapter1
Chapter1Chapter1
Chapter1
 
Basen Network
Basen NetworkBasen Network
Basen Network
 
Advanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxAdvanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptx
 
Using model-based statistical inference to learn about evolution
Using model-based statistical inference to learn about evolutionUsing model-based statistical inference to learn about evolution
Using model-based statistical inference to learn about evolution
 
Mncs 16-09-4주-변승규-introduction to the machine learning
Mncs 16-09-4주-변승규-introduction to the machine learningMncs 16-09-4주-변승규-introduction to the machine learning
Mncs 16-09-4주-변승규-introduction to the machine learning
 
Knowledge And Patterns
Knowledge And PatternsKnowledge And Patterns
Knowledge And Patterns
 
08 Inference for Networks – DYAD Model Overview (2017)
08 Inference for Networks – DYAD Model Overview (2017)08 Inference for Networks – DYAD Model Overview (2017)
08 Inference for Networks – DYAD Model Overview (2017)
 
Navies bayes
Navies bayesNavies bayes
Navies bayes
 
10 Must-Know Statistical Concepts for Data Scientists.docx
10 Must-Know Statistical Concepts for Data Scientists.docx10 Must-Know Statistical Concepts for Data Scientists.docx
10 Must-Know Statistical Concepts for Data Scientists.docx
 
Simplicial closure & higher-order link prediction
Simplicial closure & higher-order link predictionSimplicial closure & higher-order link prediction
Simplicial closure & higher-order link prediction
 
Frequentist inference only seems easy By John Mount
Frequentist inference only seems easy By John MountFrequentist inference only seems easy By John Mount
Frequentist inference only seems easy By John Mount
 
Simplicial closure and higher-order link prediction (SIAMNS18)
Simplicial closure and higher-order link prediction (SIAMNS18)Simplicial closure and higher-order link prediction (SIAMNS18)
Simplicial closure and higher-order link prediction (SIAMNS18)
 
BA4101 Question Bank.pdf
BA4101 Question Bank.pdfBA4101 Question Bank.pdf
BA4101 Question Bank.pdf
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Bayesian networks

  • 1. Bayesian Networks Massimiliano Patacchiola, PhD Student in Cognitive Robotics Centre for Robotics and Neural Systems , Plymouth University 1
  • 3. What is a Bayesian network? “A Bayesian Network (BN) is a probabilistic graphical model that represents a set of random variables and their conditional dependencies via a directed acyclic graph.” [Wikipedia] It enormously simplified the representation of probabilistic relationships between random variables. 3
  • 4. What is a Bayesian network? The nodes represent random variables. The edges represent causal relationships. Bad weather cause traffic jam (not the opposite). Inference: given the presence of traffic jam it is possible to estimate the probability of bad weather 4
  • 5. Probability Theory The backbone of Bayesian Networks 5
  • 6. Random Variable A random variable is defined as a function that maps probability to a physical outcome (labels). The possible outcome when tossing a coin are two, we can call these events [0, 1]. The probability of 0 is ½, the probability of 1 is ½. 6
  • 7. Random Variable What’s the probability of obtaining 3 rolling a fair dice? We have a total of 6 possible outcomes: [1, 2, 3, 4, 5, 6] The possibility of having 3 is ⅙ If we call X our random variable representing all these outcomes, we can say that: pX (3) = ⅙ 7
  • 8. Random Variable Rolling a pair of dices what’s the probability of having 4 and 5? The probability is 2/36 because we have 36 possible outcomes when rolling two dices and the event we are looking for can happen in two way (4,5) and (5,4). 8
  • 9. Random Variable What’s the probability that the sum of the dices is 4? The probability is 3/36 because we can obtain that sum in three ways: 9
  • 10. Probability Mass Function Suppose that X: S → A is a discrete random variable defined on a sample space S. Then the probability mass function fX : A → [0, 1] for X is defined as: 10
  • 11. Expected Value Suppose random variable X can take value x1 with probability p1 , value x2 with probability p2 , and so on, up to value xk with probability pk . Then the expectation of this random variable X is defined as: 11 Let X represent the outcome of a roll of a fair six-sided die. The possible values for X are 1, 2, 3, 4, 5, and 6, all equally likely (each having the probability of 1/6). The expectation of X is
  • 12. Joint Probability The probability that two (or more) events happen at the same time: 12 Only if the events are independent. Two events are independent if the occurrence of one does not affect the probability of occurrence of other. Similarly, two random variables are independent if the realization of one does not affect the probability distribution of the other.
  • 13. Joint Probability 13 Rolling a dice twice: the first value is an odd number AND the second value is less than four P(A) = 3/6 P(B) = 3/6 P(A,B) = P(A) * P(B) = 9/36
  • 15. Bayes Theorem The probability of an event, based on prior knowledge of conditions that might be related to the event: 15 - P(A) and P(B) are the probabilities of observing A and B without regard to each other. - P(A | B), a conditional probability, is the probability of observing event A given that B is true. - P(B | A) is the probability of observing event B given that A is true.
  • 17. Bayesian Network Design How to design a Bayesian Network? 17
  • 18. Tools for Bayesian Networks 18 GeNIe C++ Linux, Mac, Windows JavaBayes Java Linux, Mac, Windows Stan R, Python, shell, MATLAB Linux, Mac, Windows Dlib C++, Python Linux, Mac, Windows
  • 19. Tools for Bayesian Networks 19 Installing GeNIe: https://www.bayesfusion.com
  • 20. Spam Classifier (Naive Bayes) Why naive? We assume independence between each pair of features. This assumption could not be true, but for practical applications it works very well. 20
  • 21. Spam Classifier (Naive Bayes) Applying the Bayes theorem: 21 Then applying the Naive assumption we get: The denominator is constant we can estimate the value of y as:
  • 22. Spam Classifier (Naive Bayes) Feature Prior Distributions: using a corpus of emails classified as spam and ham estimating the frequency of each word. P(Money | Spam) = 0.8 Parent Prior Distribution: we assume there is no a priori reason for any incoming message to be spam rather than ham (both cases have equal probability). P(Spam)=0.5; P(Ham)=0.5 Inference: Given the words present in the incoming email estimate if the email is spam or ham. 22
  • 23. Spam Classifier (Naive Bayes) “Dear Huda. Well, another year has passed. I just can't believe that it went so quickly. I've been studying for my exams and I finished high school. Now I start my studies in the College of Medicine and I really miss the times that we spent together. I am so sorry because I didn't send letters for you. Actually, I lost your address and I was lucky to find it again. And how are you? I hope that you and your family are all right. Did you join the Interior Design College as you always wished? I really want to know your latest news and know everything about your studies. I'm writing to tell you that I have been to Europe and it was great. Do you believe that I met our friend Yara in France? It was by accident. She has been there for five years. Well, that's all about me and we're all doing fine here. I hope to hear from you soon. Take care! Your best friend“ 23
  • 24. Spam Classifier (Naive Bayes) “YES, GUARANTEED!!!! WE GUARANTEE THAT YOUR TEETH WILL BE BETWEEN 3 to 8 SHADES WHITER WITHIN THE NEXT 30 DAYS OR LESS OR YOUR MONEY BACK IN FULL. THIS IS HOW CONFIDENT WE ARE ABOUT THIS PRODUCT. NO ONE ELSE WILL OFFER YOU THIS. Take advantage as you have nothing to risk because of our money back guarantee. Buy for yourselves, your family and your friends. They'll thank you for this. Makes a wonderful Christmas gift! REMEMBER OUR SPECIAL: If you buy 2 kits, SHIPPING IS FREE. Buy 3 kits and get the 4th FREE! To order this professional-grade teeth whitening system for the superlow price of only $24.99, click on the link below to pay with a Visa or Mastercard.” 24
  • 25. The alarm example The alarm of my house can be activated by a burglary or by an earthquake. When it is activated I can receive a call by John or by Mary. 25
  • 26. The alarm example I will use GeNIe to replicate this example. First of all let’s create the five nodes using the yellow icon in the toolbar. 26
  • 27. The alarm example Selecting a node it is possible to modify the probability distributions and the conditional probability tables. The Alarm node has a table with 8 entries, given by all the possible combinations of the parents. 27
  • 28. The alarm example To enable bar chart view: Right Click on Node > View As > Bar Chart To estimate the posterior distribution: press the update icon 28
  • 29. The alarm example Let’s suppose we know there has been an earthquake while we were in the office. What’s the probability the alarm has been activated? Right Click on Earthquake node > Set evidence > True Press the update icon 29
  • 30. The alarm example Let’s suppose we receive a call from Mary. What’s the probability the alarm is active? Clear previous evidence Right Click on Mary node > Set evidence > True Press the update icon 30 Inference (Bayes Theorem)
  • 31. The alarm example The parent nodes Burglary and Earthquake are independent. The information that an earthquake occurred does not give us any hint about the occurrence of a burglary, but… If the alarm is active (evidence) the two nodes become dependent. In this case the occurrence of an Earthquake change the probability of a burglary (and vice versa). 31
  • 32. Case Studies How are Bayesian Networks used? 32
  • 33. Case Study: Medical Diagnosis Expert systems built with the help of doctors and with statistical record. Each disease has some symptoms. Using a Bayesian network we can infer the probability of a certain disease given the presence of specific symptoms. 33 Differential diagnostic tools, like DXPlain, use the Bayesian inference decision process to take into account symptom or lab result and then calculate the statistical probabilities of various diagnoses. By combining attributes from the patient’s file with clinical expertise, external data, Watson for Oncology identifies potential treatment plans for a patient.
  • 34. Case Study: Medical Diagnosis 34
  • 35. Case Study: Medical Diagnosis 35 Quiz: Do you remember the definition of independence of two random variables? Having a cold and having lung disease are a priori independent both causally and statistically. But because they are both causes of coughing if we observe cough (evidence) then cold and lung-disease become statistically dependent.
  • 36. Case Study: Fault Diagnosis 36 It is possible to build a bayesian network which describes the correlations between a system behaviour and possible faults. For example, pressure tank system, a system that discharges fluid from a reservoir into a pressure tank with a control system that regulates the operation of the pump
  • 37. Case Study: Fault Diagnosis 37 The top event considered is Pressure Tank Overfilled and the component failure modes are: PRS Pressure switch fails to open K2 Relay K2 contacts fail closed K1 Relay K1 contacts fail closed TIM Timer relay fails to timeout S1 Switch contacts fails closed
  • 38. Case Study: Cognitive Process Modelling 38 “Developmental Bayesian Model of Trust in Artificial Cognitive Systems.” Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016. Developmental Robotics: starting from children’s mental processes find mechanism to use in robotics. Replicating children’s mental processes it is possible to understand how human brain works. Bayesian Networks: can describe the mental process of children dealing with the estimation of the reliability of informants.
  • 39. Case Study: Cognitive Process Modelling 39 “Developmental Bayesian Model of Trust in Artificial Cognitive Systems.” Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016. - Two informants, one reliable and one unreliable. - The reliable informant suggests to the child the correct label for known objects. The unreliable suggests incorrect labels for known objects. - Unknown objects are presented to the child. The reliable informant suggests a label, the unreliable suggests another label. - Results: 3-years-old children do not differentiate between the two informant, whereas the 4-years-old can discriminate.
  • 40. Case Study: Cognitive Process Modelling 40 “Developmental Bayesian Model of Trust in Artificial Cognitive Systems.” Massimiliano Patacchiola and Angelo Cangelosi. Conference Epirob 2016. The actions of the child are influenced by the child’s belief and the informant’s action.