Bayesian Network
Bayesian Network
Topics covered
● Introduction to bayesian networks
● Joint probability and conditional probability
● Bayes Theorem
● Inference
● Independence in Bayes networks
● Case studies
● Implementation
2
Introduction
● calculate probability of an uncertain cause given some observed evidence
○ For eg. disease by observing symptoms (complex)
● Reversed conditional probability- in real life practice
○ ie. probability of evidence given cause
● Bayesian Networks - a graphical model
● useful tools for dealing not only with uncertainty, but also with complexity and
(even more importantly) causality,
3
Bayesian Network
● a representation of a joint
probability distribution of a set
of random variables with a
possible mutual causal
relationship
● Consists of nodes, edges and
conditional probability
distribution - directed acyclic
graph
4
Joint Probability
● The probability that two or more events happen at the same time:
5
6
Conditional Probability
7
Bayes Theorem
● Conditional Probability
○ P(a|b) = P(a,b)/P(b)
● Product Rule
○ P(a, b) = P(a|b)P(b)
● Bayes Theorem
○ P(b|a) = P(a,b)/P(a) = P(a|b)P(b)/P(a)
8
P(R, W) = P(R)P(W|R)
P(L, R, W) = P(L)P(R)P(W|R)
9
P(L, R, W, S) = P(L)P(R)P(W|R)P(S|W)
10
Bayesian Network Construction
Bayesian networks will be constructed in three consecutive steps:
The difficulty and objectivity of this step varies considerably from one problem to
another.
Our goal here is develop a Bayesian Network to capture this knowledge and then
use it to diagnose the condition of a patient suffering from some of the syptoms
mentioned above.
Alarm Example
11
Inference
● Given a bayesian network given by P(X, Y, Z), what is P(Y)?
○ First approach : Enumeration
■ A brute force approach, not practical in real life scenario
○ Second approach : Variable Elimination
■ Replacement by a function
■ Can be done in different ways each having different cost
■ Must be done in such a way that the cost is minimum
12
Enumeration
13
14
Variable Elimination
15
Alarm Example
16
Alarm Example
17
Independence in Bayes Nets
● Each variable is conditionally independent of its non descendant given its
parent
18
Independence in Bayes Nets
19
20
Case Studies
● Disease Diagnosis: Bayesian Networks are commonly used in the field of medicine for the detection and
prevention of diseases. They can be used to model the possible symptoms and predict whether or not a person is
diseased.
● Optimized Web Search: Bayesian Networks are used to improve search accuracy by understanding the intent of a
search and providing the most relevant search results. They can effectively map users intent to the relevant content
and deliver the search results.
● Spam Filtering: Bayesian models have been used in the Gmail spam filtering algorithm for years now. They can
effectively classify documents by understanding the contextual meaning of a mail. They are also used in other
document classification applications.
● Biomonitoring: Bayesian Networks play an important role in monitoring the quantity of chemical dozes used in
pharmaceutical drugs.
21
Implementation
● Problem definition: Monty Hall Problem
○ involves three doors, given that behind one of these doors is a car
○ the remaining two have goats behind them
○ So you start by picking a random door, say #2.
○ On the other hand, the host knows where the car is hidden and he opens another door, say #1 (behind which
there is a goat).
○ Here’s the catch, you’re now given a choice, the host will ask you if you want to pick door #3 instead of your
first choice i.e. #2.
○ Is it better if you switch your choice or should you stick to your first choice?
● Language Used: Python
22
Monty Hall Problem
The first step is to build a Directed Acyclic Graph.
chosen by:
23
References
● https://www.edureka.co/blog/bayesian-networks/#Bayesian%20Networks%20Application
● https://www.bu.edu/sph/files/2014/05/bayesian-networks-final.pdf
● https://www.slideshare.net/adnanmasood/bayesian-networks-primer-21281913
● https://www.slideshare.net/MassimilianoPatacchi/bayesian-networks-78623411
● https://www.youtube.com/watch?v=TuGDMj43ehw&t=56s
24
Thank You