# Q2b · Weather Naive Bayes

Subject: Natural Language Processing

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/nlp/#tee/papers/legacy-r25/q2b

Canonical: https://deep-learning-study-room.vercel.app/read/nlp/tee/papers/legacy-r25--q2b/

Previous examination · complete worked answers

**Question. Use the supplied class/conditional probabilities to predict Play Tennis for Outlook=Sunny, Temperature=Cool, Humidity=High, Windy=True.** [10 marks]

### Answer

### Given

| Class | Prior | Sunny | Cool | High | True |
| --- | --- | --- | --- | --- | --- |
| Yes | 9/14 | 2/9 | 3/9 | 3/9 | 3/9 |
| No | 5/14 | 3/5 | 1/5 | 4/5 | 3/5 |

### To find

Compare the Yes and No class scores.

### Formula: which one and why



$$
\mathrm{score}(c)=P(c)P(Sunny\mid c)P(Cool\mid c)P(High\mid c)P(True\mid c)
$$



### Step 1. Multiply the Yes factors

9/14 × 2/9 × 3/9 × 3/9 × 3/9 = 1/189 = 0.005291005

### Step 2. Multiply the No factors

5/14 × 3/5 × 1/5 × 4/5 × 3/5 = 18/875 = 0.020571429

### Step 3. Compare and normalize

Yes=0.204582651, No=0.795417349

### Final answer

**Predict No.** Apply the supplied categorical probabilities directly; adding vocabulary smoothing would solve a different problem.
