←
^
→
Naive Bayes Example
We are trying to determine if its time to PlayTennis given that
⟨
Outlook
=
sunny
,
Temp
=
cool
,
Humid
=
high
,
Wind
=
strong
⟩
We want to compute
v
NB
=
argmax
v
j
∈
V
P
(
v
j
)
∏
i
P
(
a
i
|
v
j
)
Given
this set of examples
we can calculate that
P
(
PlayTennis
=
yes
)
=
9
14
=
.
64
P
(
PlayTennis
=
no
)
=
5
14
=
.
36
similarly
P
(
Wind
=
strong
|
PlayTennis
=
yes
)
=
3
9
=
.
33
P
(
Wind
=
strong
|
PlayTennis
=
no
)
=
3
5
=
.
6
using these and few more similar probabilities we can calculate
P
(
yes
)
⋅
P
(
Outlook
=
sunny
|
yes
)
⋅
P
(
Temperature
=
cool
|
yes
)
⋅
P
(
Humidity
=
high
|
yes
)
⋅
P
(
Wind
=
strong
|
yes
)
=
.
005
P
(
no
)
⋅
P
(
Outlook
=
sunny
|
no
)
⋅
P
(
Temperature
=
cool
|
no
)
⋅
P
(
Humidity
=
high
|
no
)
⋅
P
(
Wind
=
strong
|
no
)
=
.
021
So
v
NB
=
no
José M. Vidal
.
19 of 39