Naive Bayes Example
- We are trying to determine if its time to PlayTennis given that
\[\langle Outlook=sunny, Temp=cool, Humid=high, Wind=strong \rangle \]
- We want to compute
\[ v_{NB} = \argmax_{v_{j} \in V} P(v_{j}) \prod_{i} P(a_{i} \,|\, v_{j}) \]
- Given this set of examples we can calculate that
\[ P(PlayTennis = yes) = \frac{9}{14} = .64 \]
\[ P(PlayTennis = no) = \frac{5}{14} = .36 \]
similarly
\[P(Wind = strong \,|\, PlayTennis = yes) = \frac{3}{9} = .33 \]
\[P(Wind = strong \,|\, PlayTennis = no) = \frac{3}{5} = .6 \]
using these and few more similar probabilities we can calculate
\[P(yes) \cdot P(Outlook=sunny \,|\, yes)\cdot P(Temperature = cool \,|\, yes)\cdot P(Humidity = high \,|\, yes)\cdot P(Wind = strong \,|\, yes) = .005 \]
\[P(no)\cdot P(Outlook=sunny \,|\, no)\cdot P(Temperature = cool \,|\, no)\cdot P(Humidity = high \,|\, no)\cdot P(Wind = strong \,|\, no) = .021 \]
- So
\[ v_{NB} = no \]
José M. Vidal
.
19 of 39