- Year not given
Play golf: ID3 and Naive Bayes
Short answer
Root node is outlook. ID3 predicts: (a) No, (b) Yes, (c) Yes. Naïve Bayes gives the same: (a) No, (b) Yes, (c) Yes.
Consider the following data set (Play Golf Data). Use "ID3 algorithm" and "Naïve Bayes Classifier" to predict if people will play golf on a a. Hot, Sunny day with high humidity and no wind. b. Cool, rainy day with normal humidity and no wind c. Mild, overcast, windy day with normal humidity
| SN | Outlook | Temperature (Numeric) | Temperature (Nominal) | Humidity (Numeric) | Humidity (Nominal) | Windy | Class: Play |
|---|---|---|---|---|---|---|---|
| 1 | Overcast | 83 | Hot | 86 | High | False | Yes |
| 2 | Overcast | 64 | Cool | 65 | Normal | True | Yes |
| 3 | Overcast | 72 | Mild | 90 | High | True | Yes |
| 4 | Overcast | 81 | Hot | 75 | Normal | False | Yes |
| 5 | Rainy | 70 | Mild | 96 | High | False | Yes |
| 6 | Rainy | 68 | Cool | 80 | Normal | False | Yes |
| 7 | Rainy | 65 | Cool | 70 | Normal | True | No |
| 8 | Rainy | 75 | Mild | 80 | Normal | False | Yes |
| 9 | Rainy | 71 | Mild | 91 | High | True | No |
| 10 | Sunny | 85 | Hot | 85 | High | False | No |
| 11 | Sunny | 80 | Hot | 90 | High | True | No |
| 12 | Sunny | 72 | Mild | 95 | High | False | No |
| 13 | Sunny | 69 | Cool | 70 | Normal | False | Yes |
| 14 | Sunny | 75 | Mild | 70 | Normal | True | Yes |
Assumption: the nominal columns (Temperature = Hot/Mild/Cool, Humidity = High/Normal) are used, and the numeric columns are ignored. Windy = False means "no wind". Data: 14 records, Play = Yes: 9, No: 5.
ID3
Entropy(S) = −(9/14)log₂(9/14) − (5/14)log₂(5/14) = 0.940.
| Attribute | Partitions (Yes, No) | Gain |
|---|---|---|
| Outlook | Overcast (4, 0), Rainy (3, 2), Sunny (2, 3) | 0.247 |
| Temperature | Hot (2, 2), Mild (4, 2), Cool (3, 1) | 0.029 |
| Humidity | High (3, 4), Normal (6, 1) | 0.152 |
| Windy | False (6, 2), True (3, 3) | 0.048 |
Root = Outlook. Overcast is pure (Yes).
- Sunny subset (E = 0.971): gains Temp 0.571, Humidity 0.971, Windy 0.020. High → No (3), Normal → Yes (2).
- Rainy subset (E = 0.971): gains Temp 0.020, Humidity 0.020, Windy 0.971. False → Yes (3), True → No (2).
Outlook
|-- Overcast --> Yes
|-- Sunny --> Humidity: High -> No, Normal -> Yes
|-- Rainy --> Windy: False -> Yes, True -> No
ID3 predictions
- a. Sunny, High humidity, no wind (Hot) → Sunny → High → No
- b. Rainy, Normal humidity, no wind (Cool) → Rainy → Windy = False → Yes
- c. Overcast (Mild, Normal humidity, windy) → Yes
Naïve Bayes
P(Yes) = 9/14, P(No) = 5/14.
a. X = (Sunny, Hot, High, Windy = False)
- Yes: (9/14)(2/9)(2/9)(3/9)(6/9) = 0.00705
- No: (5/14)(3/5)(2/5)(4/5)(2/5) = 0.02743
- Normalised: No = 79.5% → No
b. X = (Rainy, Cool, Normal, Windy = False)
- Yes: (9/14)(3/9)(3/9)(6/9)(6/9) = 0.03175
- No: (5/14)(2/5)(1/5)(1/5)(2/5) = 0.00229
- Yes = 93.3% → Yes
c. X = (Overcast, Mild, Normal, Windy = True)
- Yes: (9/14)(4/9)(4/9)(6/9)(3/9) = 0.02822
- No: (5/14)(0/5)(2/5)(1/5)(3/5) = 0 (Overcast never occurs with "No")
- With Laplacian correction: Yes = 0.0258, No = 0.0027 → Yes
Answer: (a) No, (b) Yes, (c) Yes, by both ID3 and Naïve Bayes.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Buys computer: ID3 and Naive Bayes · Data Mining, chapter 3
- Naive Bayes and Laplacian correction · Data Mining, chapter 3
- Naive Bayes advantages and disadvantages · Data Mining, chapter 3
- Decision tree classifier and Hunt's algorithm · Data Mining, chapter 3
- ID3 algorithm and WEKA confusion matrix · Data Mining, chapter 3
- ID3 algorithm and why greedy · Data Mining, chapter 3