written 3.0 years ago by
teamques10
★ 68k
|
•
modified 3.0 years ago
|
Consider the tuple X to classify.
X= (outlook = sunny, temperature = cool, humidity = high, windy = false)
The data tuple described by the attribute outlook, temperature, humidity, windy
The class label class which has 2 distinct values P and N
The C1 corresponds to the class P & C2 corresponds to the class N
X= (outlook = sunny, temperature = cool, humidity = high, windy = false)
We need to calculate position probability
P(X|Ci) P(Ci) for i=1,2
P(class = P) = 10 /14 = 0.714
P(class = N) = 4 /14 = 0.285
To compute P(X|Ci) for i=1,2 we compute the following conditional probabilities.
P(outlook=Sunny/class = P) = 2/10 = 0.2
P(outlook=Sunny/class = N) = 3/4= 0.75
P(temperature = cool/ class = P) = 3 /10 = 0.3
P(temperature = cool/ class = N) = 1 /4 = 0.25
P(humidity = high / class = P) = 4 /10 = 0.4
P(humidity = high / class = N) = 3 /4 = 0.75
P(windy = false / class = P) = 6 /10 = 0.6
P(windy = false / class = N) = 2 /4 = 0.5
P(X| class = P)
= P(outlook=Sunny/class = P) * P(temperature = cool/ class = P) *
P(humidity = high / class= P) * P(windy = false / class = P)
= 0.2 * 0.3 * 0.4 * 0.6
= 0.0144
P(X| class = N)
= P(outlook=Sunny/class = N) * P(temperature = cool/ class = N) *
P(humidity = high / class = N) * P(windy = false / class = N)
=0.75 * 0.25 * 0.75 * 0.5
=0.0703
To find the class Ci that maximizes P(X|Ci) P(Ci) we compute
P(X | class = P) P(class = P) = 0.0144 * 0.714 = 0.01028
P(X | class = N) P(class = N) = 0.0703 * 0.285= 0.0200
The Naive Bayes classifier algorithm predicts class N for tuple X