In order to understand Naïve Bayes, we require some basic knowledge of probability and the Bayes Theorem. To understand this, lets consider an example:

**A Dice and a Coin are thrown. What is the probability of a HEAD and a 4?**We know that Probability P of an Event E can be calculated as

**. So we can calculate the probability for this example as:**

*P(E) = Number of favorable Outcomes / Total Number of Outcomes*

*(1/2) * (1/6) = 1/12.*There are a few different types of probabilities that we need to understand before staring with Naïve Bayes Algorithm.

**Conditional Probability:**

It is the measure of probability of an Event A occurring given that another Event B has occurred.**Joint Probability:**It is the measure of two or more events happening simultaneously.**Marginal Probability:**

It is the measure of probability of an Event irrespective of the outcome of other Events.**Proportionality:**

It is the relationship between two quantities that are multiplicatively connected to a constant.

## Bayes Theorem

The Naïve Bayes Classifier is based on Bayes Theorem with the *“Naïve Assumption”* that the features are independent of each other. To understand this assumption, we shall look into what Bayes Theorem states:

**Posterior Probability:**

It is the probability of Event A occurring given that Event B has already occurred.**Prior Probability:**

It is the probability of Event A to occur before any relevant evidence is taken into account.**Likelihood:**

It is the probability of Event B occurring given that Event A has already occurred.**Marginalization:**

It is the probability of Event B occurring.

Given a feature vector ** X=(x₁,x₂,…,xₙ)** and a class variable

**, Bayes Theorem states that:**

*Cₖ*