The math behind Naive Bayes 🛸🚁

Sri Vigneshwar DJ
1 min readJan 7, 2021

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:

Bayes’ theorem 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

--

--