please provide detailed solution.. Page 4 of S Exercise 2. Weather Prediction Us
ID: 3604131 • Letter: P
Question
please provide detailed solution..
Page 4 of S Exercise 2. Weather Prediction Using Bayes Classifier 15 marks Imagine that you are given the following set of training examples. Training Data Play Tennis No Outlookk Temperature Humadity Wind Day 1 85 80 Day 4 Day 5 Day 6 Da Day 8 Day 9 Day 10 Day 11 Sun Sunn Overcast Rain Rain Rain Overcast Sunn Sun Rain Sunn Overcast Overcast Rain Weak Stron Weak Weak Weak Stron Stron Weak Weak Weak Stron Stron Weak Stron 68 65 80 65 95 72 60 75 75 Day 13 Day 14 81 No Assume that you have been given the following test data Test data Wind Weak Stron Strom Weak Stron Tennis Outlook Rain Ovecast Sun Overcast Rain Temperature Humidit 68 85 Yes 80 Tasks a) b) c) Discuss and comment on the results Classify the above test data using the Bayes Classifier model. each test case separately Develop a confusion matrix and calculate the accuracy and error rate of the NB classifier Show the calculations forExplanation / Answer
a) Sine we have 4 attributes we need to find probability of the game tennis played based on each attribute. So for aech attribute a table is to be constructed. Also from the data there are 5 cases where game can't be played and 9 cases where the game can be played.
OUTLOOK
Play=Yes
Play=No
Total
Sunny
2/9
3/5
5/14
Overcast
4/9
0/5
4/14
Rain
3/9
2/5
5/14
Since temperature is numeric values we need to deiscretize it as High,Medium,Low such that
temp 60-70 low
temp 70-80 medium
temp 80-90 high
TEMPERATURE
Play=Yes
Play=No
Total
Low
3/9
1/5
4/14
Medium
4/9
2/5
6/14
High
2/9
2/5
4/14
The same thing nedd to do in th case of humidity
humidity 60-70 Low4/
humdity 70-80 Medium
humidity 80 above High
HUMIDITY
Play=Yes
Play=No
Total
Low
1/9
0/5
1/14
Medium
4/9
1/5
5/14
High
4/9
4/5
8/14
WIND
Play=Yes
Play=No
Total
Weak
6/9
2/5
8/14
Strong
3/9
3/5
6/14
Also P(Play=Yes)=9/14 and P(play=No)=5/14
Now we have gathered all information for the calssifier.In the next step we can test it using test cases
1. X = (Outlook=Rain, Temperature=Low, Humidity=High, Wind=Weak)
from the table
Next we consider the fact that we cannot play a game:
P(X|Play=Yes)P(Play=Yes) =(3/9) * (3/9) * (4/9) * (6/9) * (9/14) = 0.0211
P(X|Play=No)P(Play=No) = (2/5) * (1/5) * (4/5) * (2/5) * (5/14) = 0.0091
Finally, we have to divide both results by the evidence
Then, dividing the results by this value
§ P(Play=Yes | X) = 0.0211/0.033 = 0.6393
§ P(Play=No | X) = 0.0091/0.033= 0.2757
Since Play=Yes has the highest value we can play tennis in this case
OUTLOOK
Play=Yes
Play=No
Total
Sunny
2/9
3/5
5/14
Overcast
4/9
0/5
4/14
Rain
3/9
2/5
5/14
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.