Naive Bayes
Naive Bayes
Naive Bayes
Tuan Nguyen
April 20, 2023
Classification problem
Bayes theorem
Relevant Issues
Bayes’ theorem
Figure 1: Dataset
Then we calculate and compare p(Yes|x) and p(No|x), then make the
prediction
Nik + α
p(xi |Ck ) =
Nk + dα
α is a positive number, default value is 1.
▶ When there are a lot of feature, the multiplication of probability
could lead to 0, we can take the log then compare.
d
X
log p(Ck |x) = log p(Ck ) + log p(xi |Ck )
i=1
(xi − µik )2
1
p(xi |Ck ) = √ exp − 2
2πσik 2σik
▶ In the training phase, we need to find σik , µik for each feature in
each category based on the dataset.