The math behind Naive Bayes đ¸đ
Naive Bayes is a classification algorithm, it is based on Bayesâ Theorem with an assumption of independence among predictors. Naive Bayes will be exciting when you understand BayesâTheorem.
Letâs understand Bayesâ Theorem
Mathematically Bayesâs Theorem is a formula for determining conditional probability. Conditional probability is the likelihood of an outcome occurring, based on a previous outcome occurring.
Formula
The Bayesâ theorem is expressed in the following formula:
where,
- P(A|B) â the probability of event A occurring, given event B has occurred
- P(B|A) â the probability of event B occurring, given event A has occurred
- P(A) â the probability of event A
- P(B) â the probability of event B
Why itâs called Naive?
The reason is that Bayes classification assumes that the presence or absence of a particular class is unrelated to other class (independent variable) that is present or absent. Naive Bayes is based on the assumption, this is not guaranteed results.
Naive Bayes in Python