Key concepts
The naïve Bayes classifier uses Bayes’ theorem to predict class membership. Bayes’ theorem describes the relationship between the probability of an event and the probability of an event given new, relevant data. The probability of an event given new data is called the posterior probability. The probability of an event occurring before the new data is appropriately referred to as the prior probability.
Bayes’ theorem gives us the following equation:
The posterior probability (the probability of an event given new data) is equal to the probability of the data given the event, times the prior probability of the event, divided by the probability of the new data.
Somewhat less colloquially, this is typically written as follows:
Here, A is an event, such as class membership, and B is new information. When applied to classification, we get the following equation: