0% found this document useful (0 votes)
14 views21 pages

Bayesian Network

machine learning notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views21 pages

Bayesian Network

machine learning notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Artificial Intelligence

Dr. Nidhi Kushwaha

Indian Institute of Information Technology,


Ranchi, India
Overview 2

• Quantifying Uncertainty
– Basic Probability Notation
– Prior/ Unconditional Probability
– Posterior/Conditional Probability
– Bayes’s Rule and its use
• Naïve Bayes Classification
– Example
• Bayesian Network
– Example
• Summary
4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi
Bayesian Networks on DAG
3

• "A Bayesian network is a probabilistic graphical model which represents a set of variables
and their conditional dependencies using a directed acyclic graph.“

• It is also called a Bayes network, belief network, decision network, or Bayesian model.

• Bayesian networks are probabilistic, because these networks are built from a probability
distribution, and also use probability theory for prediction.

• Real world applications are probabilistic in nature, and to represent the relationship
between multiple events, we need a Bayesian network.

• It can also be used in various tasks including prediction, anomaly detection, diagnostics,
automated insight, reasoning, time series prediction, and decision making under
uncertainty.
4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi
Bayesian Networks 4

• Bayesian Network can be used for building models from data and experts opinions, and it
consists of two parts:

• Directed Acyclic Graph

• Table of conditional probabilities.

The generalized form of Bayesian network that represents and solve decision problems under
uncertain knowledge is known as an Influence diagram.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


Bayesian Networks 5

• Bayesian belief network allows a subset of the variables conditionally independent and dependent .
• A graphical model of causal relationships
– Represents dependency among the variables
– Gives a specification of joint probability distribution

• Nodes: random variables


• Links: represents the relationship or dependency
X Y between variables
• X,Y are the parents of Z, and Y is the parent of P
Z • No dependency between Z and P
P
• Directed Acyclic Graph with no loops or cycles
• Each node has Conditional Probability Table (CPT)
4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi
6

Bayesian Belief Network: Example 1


(FH, S) (FH, ~S) (~FH, S) (~FH, ~S)
Family Smoke
History r LC 0.7
0.8 0.5 0.1
~LC 0.2 0.5 0.3 0.9

LungC Emphy The conditional probability table for the


ancer sema
variable LungCancer:
Shows the conditional probability for each
possible combination of its parents
Positiv Dyspne
eXRay a

Bayesian Belief Networks


4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi
7

Joint Probability Distribution

P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi))

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


8

Bayesian Belief Network: Example 2

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


9

Bayesian Belief Network: Example 2 (Conti..)

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


10

Bayesian Belief Network: Example 2 (Conti..)

Calculate the probability that alarm has sounded, but there is neither a burglary, nor an earthquake occurred, and
John and Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


11

Bayesian Belief Network: Example 2 (Conti..)


Description of Bayesian Belief Network:

• The network structure is showing that burglary and


earthquake is the parent node of the alarm and directly
affecting the probability of alarm's going off, but call to John
and Marry depend on alarm probability.

• The conditional distributions for each node are given as


conditional probabilities table or CPT.

• In CPT, a Boolean variable with k Boolean parents contains


2K probabilities. Hence, if there are two parents, then CPT
will contain 4 probability values

Calculate the probability that alarm has sounded, but there is


neither a burglary, nor an earthquake occurred, and John and
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


12

Bayesian Belief Network: Example 2 (Conti..)


Description of Bayesian Belief Network:

List of all events occurring in this network:

•Burglary (B)

•Earthquake(E)

•Alarm(A)

•John Calls(J)

•Marry Calls(M)

Calculate the probability that alarm has sounded, but there is


neither a burglary, nor an earthquake occurred, and John and
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


13

Bayesian Belief Network: Example 2 (Conti..)


Description of Bayesian Belief Network:

We can write the events of problem statement in the form of


probability:

P[J, M, A, B, E], can rewrite the above probability statement


using joint probability distribution:

P[J, M, A, B, E]= P[J | M, A, B, E]. P[M, A, B, E]

= P[J | M, A, B, E]. P[M | A, B, E]. P[A, B, E]

= P[J | A]. P [ M| A, B, E]. P[ A, B, E]

= P[J | A]. P[ M | A]. P[A| B, E]. P[B, E]


Calculate the probability that alarm has sounded, but there is
neither a burglary, nor an earthquake occurred, and John and = P[J | A ]. P[M | A]. P[A| B, E]. P[B |E]. P[E]
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


14

Bayesian Belief Network: Example 2 (Conti..)


Let's take the observed probability and CPT for the Burglary and
earthquake component:

P(B= True) = 0.001, which is the probability of burglary.


P(B= False)= 0.999, which is the probability of no burglary.
T 0.01

F 0.999

P(E= True)= 0.002, which is the probability of a minor earthquake


P(E= False)= 0.998, Which is the probability that an earthquake
not occurred.

T 0.002
Calculate the probability that alarm has sounded, but there is
F 0.998
neither a burglary, nor an earthquake occurred, and John and
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


15

Bayesian Belief Network: Example 2 (Conti..)


T 0.002
T 0.01 F 0.998 Conditional probability table for Alarm A:
F 0.999
The Conditional probability of Alarm (A) depends on Burglar (B)
and Earthquake (E):

B E P(A=T) P(A=F)
T T 0.95 0.05
T F 0.94 0.06
F T 0.29 0.71
F F 0.001 0.99

Calculate the probability that alarm has sounded, but there is


neither a burglary, nor an earthquake occurred, and John and
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


16

Bayesian Belief Network: Example 2 (Conti..)


T 0.002 Conditional probability table for John Calls:
T 0.01 F 0.998
F 0.999 The Conditional probability of John Calls (J) depends on Alarm
(A):
A P(J=T) P(J=F)
B E P(A=T) P(A=F) T 0.90 0.1
T T 0.95 0.05

T F 0.94 0.06
F 0.05 0.95
F T 0.29 0.71

F F 0.001 0.99 Conditional probability table for Marry Calls:

The Conditional probability of Marry Calls (M) depends on


Alarm (A):
A P(M=T) P(M=F)
T 0.70 0.3
Calculate the probability that alarm has sounded, but there is
neither a burglary, nor an earthquake occurred, and John and F 0.01 0.99
Marry both called.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


17

Bayesian Belief Network: Example 2 (Conti..)


T 0.002
Calculate the probability that alarm has sounded, but there is
T 0.01
neither a burglary, nor an earthquake occurred, and John and
F 0.998
F 0.999
Marry both called.

From the formula of joint distribution, we can write the problem


B E P(A=T) P(A=F)
statement in the form of probability distribution:
T T 0.95 0.05

T F 0.94 0.06
P(J, M, A, ¬B, ¬E) = P (J|A) *P (M|A)*P (A|¬B ^ ¬E) *P (¬B) *P (¬E).
F T 0.29 0.71

F F 0.001 0.99
= 0.90 * 0.70 * 0.001 * 0.999 * 0.998

= 0.0006729.

Hence, a Bayesian network can answer any query about the


A P(J=T) P(J=F) A P(M=T) P(M=F) domain by using Joint distribution.
T 0.90 0.1 T 0.70 0.3
F 0.05 0.95 F 0.01 0.99

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


Example-2
Suppose we want to use the diagnostic assistant to diagnose whether there is a fire in a building based on noisy
sensor information and possibly conflicting explanations of what could be going on. The agent receives a report
about whether everyone is leaving the building. Suppose the report sensor is noisy: It sometimes reports leaving
when there is no exodus (a false positive), and it sometimes does not report when everyone is leaving (a false
negative). Suppose the fire alarm going off can cause the leaving, but this is not a deterministic relationship.
Either tampering or fire could affect the alarm. Fire also causes smoke to rise from the building.

Suppose we use the following variables, all of which are Boolean, in the following order:

Tampering is true when there is tampering with the alarm.


Fire is true when there is a fire.
Alarm is true when the alarm sounds.
Smoke is true when there is smoke.
Leaving is true if there are many people leaving the building at once.
Report is true if there is a report given by someone of people leaving. Report is false if there is no report of
leaving.

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi 18


Example-2

Fire is conditionally independent of Tampering (given no other information).


Alarm depends on both Fire and Tampering. That is, we are making no independence
assumptions about how Alarm depends on its predecessors given this variable
ordering.
Smoke depends only on Fire and is conditionally independent
of Tampering and Alarm given whether there is a Fire.
Leaving only depends on Alarm and not directly on Fire or Tampering or Smoke. That
is, Leaving is conditionally independent of the other variables given Alarm.
Report only directly depends on Leaving.

P(Tampering, Fire, larm, Smoke, Leaving, Report) =

P(Tampering) ×P(Fire) ×P(Alarm |Tampering, Fire) ×P(Smoke | Fire)


×P(Leaving | Alarm) ×P(Report | Leaving).

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi 19


20

Summary

4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi


21

Thank
4/28/2024 IIITU-CSSE12-C17VL3 by Dr. Nidhi

You might also like