Unit4 C
Unit4 C
Bayesian and
Computational Learning
Dr Raghavendra S
Associate Professor & Coordinator
BTech(CSE) in AIML
2
Excellence and Service
CHRIST
Deemed to be University
BAYES
THEOREM
3
Excellence and Service
CHRIST
Deemed to be University
Bayesian Learning
Where,
P(A|B) : Probability of A given B
P(B|A) : Probability of B given A
P(A) : Prior Probability of event A
P(B) : Prior Probability of event B
Algorithmic Steps
1. Compute Prior Probability of A
2. Compute Prior Probability of B
3. Compute Likelihood Probability of B given A
4. Find Posterior Probability of A given B using step 1,2,3
5
Excellence and Service
CHRIST
Deemed to be University
This is Bayes
Theorem
6
Excellence and Service
CHRIST
Deemed to be University
Ex
7
Excellence and Service
CHRIST
Deemed to be University
h: Hypothesis
D: Training Data
Max
New patient is not
having cancer
8
Excellence and Service
CHRIST
Deemed to be University
Max
New patient is not
having cancer
9
Excellence and Service
CHRIST
Deemed to be University
CONCEPT
LEARNING
10
Excellence and Service
CHRIST
Deemed to be University
11
Excellence and Service
CHRIST
Deemed to be University
Concept Learning
12
Excellence and Service
CHRIST
Deemed to be University
Concept Learning
Case Study
13
Excellence and Service
CHRIST
Deemed to be University
In which
heuristically search
for the most
optimum or best
solution wrt given
training set
14
Excellence and Service
CHRIST
Deemed to be University
Possible
values for
each
attributes
15
Excellence and Service
CHRIST
Deemed to be University
16
Excellence and Service
CHRIST
Deemed to be University
17
Excellence and Service
CHRIST
Deemed to be University
18
Excellence and Service
CHRIST
Deemed to be University
19
Excellence and Service
CHRIST
Deemed to be University
20
Excellence and Service
CHRIST
Deemed to be University
21
Excellence and Service
CHRIST
Deemed to be University
22
Excellence and Service
CHRIST
Deemed to be University
23
Excellence and Service
CHRIST
Deemed to be University
24
Excellence and Service
CHRIST
Deemed to be University
25
Excellence and Service
CHRIST
Deemed to be University
26
Excellence and Service
CHRIST
Deemed to be University
27
Excellence and Service
CHRIST
Deemed to be University
28
Excellence and Service
CHRIST
Deemed to be University
29
Excellence and Service
CHRIST
Deemed to be University
30
Excellence and Service
CHRIST
Deemed to be University
31
Excellence and Service
CHRIST
Deemed to be University
32
Excellence and Service
CHRIST
Deemed to be University
33
Excellence and Service
CHRIST
Deemed to be University
Maximum
Likelihood
&
Least Squared
Error
Excellence and Service
34
CHRIST
Deemed to be University
35
Excellence and Service
CHRIST
Deemed to be University
36
Excellence and Service
CHRIST
Deemed to be University
37
Excellence and Service
CHRIST
Deemed to be University
38
Excellence and Service
CHRIST
Deemed to be University
39
Excellence and Service
CHRIST
Deemed to be University
40
Excellence and Service
CHRIST
Deemed to be University
41
Excellence and Service
CHRIST
Deemed to be University
42
Excellence and Service
CHRIST
Deemed to be University
43
Excellence and Service
CHRIST
Deemed to be University
44
Excellence and Service
CHRIST
Deemed to be University
45
Excellence and Service
CHRIST
Deemed to be University
46
Excellence and Service
CHRIST
Deemed to be University
47
Excellence and Service
CHRIST
Deemed to be University
MLE-In case of discrete values
48
Excellence and Service
CHRIST
Deemed to be University
49
Excellence and Service
CHRIST
Deemed to be University
BAYES OPTIMAL
CLASSIFIER
(Maximization function)
50
Excellence and Service
CHRIST
Deemed to be University
51
Excellence and Service
CHRIST
Deemed to be University
52
Excellence and Service
CHRIST
Deemed to be University
53
Excellence and Service
CHRIST
Deemed to be University
55
Excellence and Service
CHRIST
Deemed to be University
GIBBS
ALGORITHM
For more hypothesis
56
Excellence and Service
CHRIST
Deemed to be University
Gibbs Algorithm
57
Excellence and Service
CHRIST
Deemed to be University
58
Excellence and Service
CHRIST
Deemed to be University
59
Excellence and Service
CHRIST
Deemed to be University
60
Excellence and Service
CHRIST
Deemed to be University
61
Excellence and Service
CHRIST
Deemed to be University
Po= LPr/Pr
62
Excellence and Service
CHRIST
Deemed to be University
63
Excellence and Service
CHRIST
Deemed to be University
64
Excellence and Service
CHRIST
Deemed to be University
65
Excellence and Service
CHRIST
Deemed to be University
66
Excellence and Service
CHRIST
Deemed to be University
EXAMPLE1
NAÏVE BAYES CLASSIFIER
67
Excellence and Service
CHRIST
Deemed to be University
Example1:
Find the probability of the given instance for the given prior and
conditional probabilities using Naïve Bayes Theorem
1 Target variable with
4 Attributes with given Cond. Prob given prior Prob
Find
probability of
the given
instance
68
Excellence and Service
CHRIST
Deemed to be University
69
Excellence and Service
CHRIST
Deemed to be University
70
Excellence and Service
CHRIST
Deemed to be University
71
Excellence and Service
CHRIST
Deemed to be University
Problem Firmulation
2/9 * 9/14
--------------- = 0.399
5/14
72
Excellence and Service
CHRIST
Deemed to be University
Example2: (3 Targets, 3 Attributes)
Find the Probability of a given Fruit being Orange, banana or others given its
prior probabilities having 3 attributes being yellow, Sweet, and Long given its
conditional probabilities using Naïve Bayes Algorithm
3 Target Variables
with given prior
Prob 3 Attributes with given conditional Prob
73
Excellence and Service
Fruit yellow Sweet Long Total
CHRIST
Orange 350 450 0 650 Deemed to be University
74
Excellence and Service
CHRIST
Deemed to be University
Similarly
Determine probability of Fruit being Banana & Others
75
Excellence and Service
CHRIST
Deemed to be University
Joint Probability
Distribution
For all combinations of Variables
76
Excellence and Service
CHRIST
Deemed to be University
X is not true
Y is not true
77
Excellence and Service
CHRIST
Deemed to be University
78
Excellence and Service
CHRIST
Deemed to be University
Bayesian Belief
Network
Also called as
Bayesian Network/Belief
Network/Probabilistic N/w
79
Excellence and Service
CHRIST
Deemed to be University
Bayesian Networks
● 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 and anomaly
detection.
● Real world applications are probabilistic in nature, and
to represent the relationship between multiple events,
we need a Bayesian network.
● Bayesian Network can be used for building models from
data and experts opinions, and it consists of two parts:
1. Directed Acyclic Graph
2. Table of conditional probabilities. 80
Excellence and Service
CHRIST
Deemed to be University
Bayesian Networks
82
Excellence and Service
CHRIST
Deemed to be University
84
Excellence and Service
CHRIST
Deemed to be University
86
Excellence and Service
CHRIST
Deemed to be University
87
Excellence and Service
CHRIST
Deemed to be University
88
Excellence and Service
CHRIST
Deemed to be University
89
Excellence and Service
CHRIST
Deemed to be University
90
Excellence and Service
CHRIST
Deemed to be University
EM Algorithm
91
Excellence and Service
CHRIST
Deemed to be University
92
Excellence and Service
CHRIST
Deemed to be University
EM
Algorithm
Expectation Maximization For Unsupervised
Learning
93
Excellence and Service
CHRIST
Deemed to be University
EM Algorithm
94
Excellence and Service
CHRIST
Deemed to be University
EM Algorithm
Clustering
Get best
Cluster
95
Excellence and Service
CHRIST
Deemed to be University
EM Flow Chart
96
Excellence and Service
CHRIST
Deemed to be University
97
Excellence and Service
CHRIST
Deemed to be University
EM Algorithm: Example1
Problem definition
• Let A & B : two Coins
• ϴ1: Probability of Getting Head with Coin A
• ϴ2: Probability of Getting Head with Coin B
• Find the final probability values of ϴ1 & ϴ2 by tossing
coin A & B 5 times randomly
98
Excellence and Service
CHRIST
Deemed to be University
99
Excellence and Service
CHRIST
Deemed to be University
102
Excellence and Service
CHRIST
Deemed to be University
E-Step2
103
Excellence and Service
CHRIST
Deemed to be University
Repeat Step1 to
Step4 till the
convergence
Reached
104
Excellence and Service
CHRIST
Deemed to be University
Theta A 0.6
Theat B 0.5
105
Excellence and Service
CHRIST
Deemed to be University
106
Excellence and Service
CHRIST
Deemed to be University
Unit4 Summary
●Bayes Theorem- Derivation
●Concept Learning
●Maximum Likelihood(Minimization)
●Minimum Description Length Principle
●Bayes Optimal Classifier(Maximization)
●Gibbs Algorithm(n Hypothesis)
●Naïve Bayes Classifier((Maximization)
●Bayesian Belief Network(Conditional Prob)
●EM Algorithm.(Clustering)
107
Excellence and Service