Naive Bayes Classification


Naive Bayes Algorithm is a classification technique based on Bayesian Statistics. Naive Bayes is an easy to understand and implement algorithm. This post will walk you through the underlying concept of the Naive Bayes Algorithm and how to implement it using Python3.

Naive Bayes algorithm extensively using two important concepts of probability known as Prior Probabilities and Posterior Probabilities. So, let’s get started with that.

Posterior and Prior Probabilities

Prior Probability – In layman terms, prior probability is the probability distribution that is calculated without taking into account any evidence from the data. In other words, it is simply calculated as :

Prior Probability = Favourable Observation / Total Observations

Posterior Probability – Posterior probability is the probability calculated after taking into account the evidences found from the data.

Posterior Probability = (Likelihood * Prior Probability of a class) / Prior Probability of features

The mathematical formula for posterior probability is given as:

P(c|x) = [P(x|C)*p(c)] / P(X)

Close Menu