You are on page 1of 32

BAYESIAN

NETWORK
OBJECTIVES
You should be able to do the following:
1. Understand the basic concepts of Bayes’ Theorem
2. Perform Bayesian Analysis using GeNIe
IMAGINE
IT IS YOU!
One day…
Cough

Fever

Sore
throat
Sore
Cough Fever
throat
COVID-19
But then a new symptom
emerges…

Chest
Pain
Now you are
not sure
what is
happening
with you…
You are dealing with
UNCERTAINTY
You believe that you are having a
Covid-19

New information emerges so you’re


having a second thought

In engineering practice, it is called


reasoning with uncertainty
BAYESIAN NETWORK
A method to deal
with reasoning with
uncertainty
BAYESIAN NETWORK
BNs enable us to model and reason about uncertainty.

BNs accommodate both subjective probabilities and


probabilities based on objective data.

The most important use of BNs is in revising


probabilities in the light of actual observations of
events.
BN… Heart
Disease

Sore Chest
Cough Fever
throat Pain
BN… Class
Performance

Assignment Final
Quiz Midterm
Exam
BAYESIAN
NETWORK
• A BN is a special type of diagram
(called a directed graph) together
with an associated set of
probability tables.
• The graph consists of nodes and arcs.
• The nodes represent variables, which
can be discrete or continuous.
• The arcs represent causal
relationships between
variables.
Node
Heart
Disease

Arc Arc Arc Arc

Sore Chest
Cough Fever
throat Pain

Node Node Node Node


BASIC
CONCEPTS
The Joint Probability
Distribution

𝑃 𝐻 = 𝑡𝑟𝑢𝑒, 𝐹 = 𝑡𝑟𝑢𝑒
𝑃 𝐻 = 𝑡𝑟𝑢𝑒 𝐹 = 𝑡𝑟𝑢𝑒 =
𝑃(𝐹 = 𝑡𝑟𝑢𝑒)

𝑃 𝐻∩𝐹
𝑃 𝐻𝐹 = 𝑃 𝐻 ∩ 𝐹 = 𝑃 𝐻 𝐹 𝑃(𝐹)
𝑃(𝐹)
Bayes’ Theorem
P(A l B) can be defined without joint probability
P(A,B) by rearranging the conditional
probability formula as given below

𝑃(𝐴 ∩ 𝐵)
𝑃 𝐴𝐵 =
𝑃(𝐵)

𝑃 𝐵 𝐴 𝑃(𝐴)
𝑃 𝐴𝐵 =
𝑃(𝐵)
What if we have 3 variables?
Remember…
𝑃(𝐴 ∩ 𝐵)
𝑃 𝐴𝐵 =
𝑃(𝐵)

𝑃 𝐴 ∩ 𝐵 = 𝑃(𝐴, 𝐵) = 𝑃 𝐴 𝐵 𝑃(𝐵)
So…
𝑃 𝐴, 𝐵, 𝐶 = 𝑃(𝐴 ∩ 𝐵 ∩ 𝐶) = 𝑃 𝐴 𝐵, 𝐶 𝑃(𝐵, 𝐶)
= 𝑃 𝐴 𝐵, 𝐶 𝑃 𝐵 𝐶 𝑃(𝐶)
Directed Acyclic Graphs Parent of B
(DAG) A
A Bayesian network is made up of
1. A directed Acyclic Graph
Child of A/ Parent
2. Set of tables for each node of C and D
B

A is called ancestor of D or C
D or C is a descendent of A C D
Child of B
Child of B

Tables are called Conditional Probability Tables (CPT)


ACYCLIC VS CYCLIC

A A

B B

C D C D

ACYCLIC CYCLIC
BN EXAMPLE (during
probstat class)
A printer manufacturer obtained the following three types of
printer failure probabilities. Hardware P(H) = 0.3, software
P(S) = 0.6, and other P(O) = 0.1.
Also, P(F | H) = 0.9, P(F | S) = 0.2, and P(F | O) = 0.5.

If a failure occurs, determine if it’s most likely due to hardware,


software, or other!
BN EXAMPLE (during
probstat class)
DAG: Parent

Types of failure

Failure occurrence

Child
BN EXAMPLE (during
probstat class)
Probabilities
Failure Occurrence

Types of failure STATE H S 0


STATE P(…) Yes 0.9 0.2 0.5
H 0.3 No 0.1 0.8 0.5
S 0.6
O 0.1
BN EXAMPLE (during probstat class)

Probabilities

P(F)= P(F|H) P(H)+P(F|S) P(S)+P(F|O) P(O) = 0.44

P(H|F)= P(F|H) P(H) / P(F) = 0.61


P(S|F) = P(F|S) P(S) / P(F) = 0.27
P(O|F)= P(F|O) P(O) / P(F) =0.11
BN EXAMPLE

if you turn on a computer but it does not start (this is


your observation/evidence) then we assess (say) two
possible causes; it may be failure of electricity and it
may be due to computer malfunction . Calculate the
probability of the computer fails!
BN EXAMPLE
DAG:
Parent Parent
Failure of Computer
electricity Malfunctioning

Computer
Failure

Child
BN EXAMPLE
Probabilities: Computer failure (C)
Electricity failure (E) E M C P(C|E,M)
STATE P(E) yes yes Yes 1
Yes 0.1 yes yes No 0
No 0.9 yes no Yes 1
yes no No 0
Computer Malfunction (M)
no yes Yes 0.5
STATE P(M)
no yes No 0.5
Yes 0.2
No 0.8
no no Yes 0
no no No 1
BN EXAMPLE 𝑃 𝐶 = 𝑦𝑒𝑠
= 𝜎𝐸,𝑀 𝑃 𝐶 = 𝑦𝑒𝑠, 𝐸, 𝑀
Computer failure (C) = 𝑃 𝐶 = 𝑦𝑒𝑠 𝐸, 𝑀 𝑃 𝐸 𝑃 𝑀
E M C P(C|E,M)
yes yes Yes 1 P(C = yes l E = no, M = no). P(E
yes yes No 0 = no). P(M = no) +
yes no Yes 1 P(C = yes l E = yes, M = yes).
yes no No 0 P(E = yes). P(M = yes)
P(C = yes l E = yes, M = no).
no yes Yes 0.5
P(E = yes). P(M = no) +
no yes No 0.5 = P(C = yes l E = no, M = yes).
no no Yes 0 P(E = no). P(M = yes) +
no no No 1
BN EXAMPLE
P(C=yes)= 0.5x0.9x0.2 + 1x0.1x0.8 + 0x0.9x0.8 + 1x0.1x0.2 = 0.19

P(C=no)= 1- 0.19 = 0.81

If the computer fails, what is the


probability that it is caused by
computer malfunction or electrical
failure?

You might also like