Day Outlook Temperature Humidity Wind Play
1 Sunny Hot High False No
2 Sunny Hot High True No
3 Overcast Hot High False Yes
4 Rain Mild High False Yes
5 Rain Cool Normal False Yes
6 Rain Cool Normal True No
7 Overcast Cool Normal True Yes
8 Sunny Mild High False No
9 Sunny Cool Normal False Yes
10 Rain Mild Normal False Yes
11 Sunny Mild Normal True Yes
12 Overcast Mild High True Yes
13 Overcast Hot Normal False Yes
14 Rain Mild High True No
Table 1 depicts the dataset for representing the decision of playing tennis or not given particular features (Outlook, Temperature, Humidity, Wind). As an expert in decision making under uncertainty, you are requested to provide a system that can decide whether to play tennis or not given a set of condition. Follow the steps below:
Step 1: Reading Dataset
Your program MUST first read all the data shown in Table 1. Data must be stored inside an external file.
A user can enter new data, delete old data, and retrieve existing data from the external file. In case new data in added or old data being deleted, the program must recalculated the answer.
Step 2: Categorization according to features
Compute probabilities from the dataset given above. Your program should be able to categorize according to the four features (Outlook, Temperature, Humidity, Wind).
P(p) = 9/14
P(n) = 5/14
[note: P(x) denotes probability of x, p denotes play, n denotes not play]
You program MUST be able to calculate the information as shown in Table 2.
Step 3: Classifying X
Your program must allow user to key-in a set of condition. Example: X = [rain, hot, high, false]
Your program must be able to calculate show the results:
P(X|p)•P(p) = P(rain|p)•P(hot|p)•P(high|p)•P(false|p)•P(p) = 3/9•2/9•3/9•6/9•9/14 = 0.010582
P(X|n)•P(n) = P(rain|n)•P(hot|n)•P(high|n)•P(false|n)•P(n) = 2/5•2/5•4/5•2/5•5/14 = 0.018286
Step 4: Decision Making
Since P(X|n)•P(n) > P(X|p)•P(p), the decision is NOT play. Your program MUST be able to display the final decision.