In: Computer Science
Sunny |
true |
None |
Play |
rain |
True |
Slight |
Stay Home |
overcast |
false |
slight |
Play |
rain |
false |
heavy |
Stay Home |
Sunny |
true |
none |
Play |
overcast |
false |
slight |
Play |
overcast |
true |
heavy |
?????? |
Question 2: [10 Marks]
instance 6 |
3.2 |
5.4 |
?? |
Instances |
Attribute 1 |
Attribute 2 |
Class |
instance 1 |
0.8 |
6.3 |
Positive |
instance 2 |
1.4 |
8.1 |
Negative |
instance 3 |
1.2 |
7.4 |
Positive |
instance 4 |
6.2 |
14.3 |
Positive |
instance 5 |
6.8 |
11.6 |
Negative |
|
|
Question 1
(a) Prior Probabilities of each Class Label:
Stay Home = 2/6 = 0.3334
Play = 4/6 = 0.6667
(b) Conditional Probabilities for each attributes are:
Outlook (X1) | P(X1/Y=Play) | P(X1/Y=Stay Home) |
Sunny | 2/4 | 0/2 |
Rain | 0/4 | 2/2 |
Overcast | 2/4 | 0/2 |
Windy (X2) | P(X2/Y=Play) | P(X2/Y=Stay Home) |
True | 2/4 | 1/2 |
False | 2/4 | 1/2 |
Rain (X3) | P(X3/Y=Play) | P(X3/Y=Stay Home) |
None | 2/4 | 0/2 |
Slight | 2/4 | 1/2 |
Heavy | 0/4 | 1/2 |
(c) Predicting using Naive Bayes
X1 = Overcast, X2 = True and X3 = Heavy
P(Play/X) = 2/4 * 2/4 * 0/4 * 4/6 = 0
P(Stay Home/X) = 0/2 * 1/2 * 1/2 * 2/6 = 0
In order to calculate any legitimate value to probability, adding 0.01 to both the probabilities result to smoothen the function value.
P(Play/X) = 0.01
P(Stay Home/X) = 0.01
As P(Play/X) + P(Stay Home/X) = 1
Hence, converting these numbers to make sum = 1
P(Play/X) = 0.5 and
P(Stay Home/X) = 0.5
Both the probabilities are same, and hence
(i) As the prior probability of Playing is >= 0.667, hence
Then it will be classified into Stay Home as p < 0.667
Question 2
From the above graph the three nearest neighbors of unseen attribute are (0.8 , 6.3), (1.4 , 8.1), (1.2 , 7.4)
out of which 2 is postive and 1 is negative..
So the unseen attribute is classified as positive.