Book Image

Mastering Python for Data Science

By : Samir Madhavan
Book Image

Mastering Python for Data Science

By: Samir Madhavan

Overview of this book

Table of Contents (19 chapters)
Mastering Python for Data Science
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
7
Estimating the Likelihood of Events
Index

The naive Bayes classifier


The naive Bayes classifier is a simple probabilistic classifier, which is based on the Bayes theorem. The assumption made is that there is strong interdependence between the features, because of which it is called naive. The following is the Bayes theorem:

Here in the preceding formula, A and B are events, P(A) and P(B) are the probabilities of A and B and are interdependent of each other. P(A|B) is the probability of A, given that B is True, which is a conditional probability. P(B|A) is the probability of B, given that A is True. The naive Bayes formula is as follows:

Let's try solving this equation to understand the naive Bayes formula with the following example:

Stacy has her engagement tomorrow in Austin at an outdoor ceremony. In the past few years, Austin has had only six rainy days in a year. Unfortunately, there has been rain forecast for tomorrow by the weatherman. 80% of the time, the weatherman accurately forecasts the rain. However, he incorrectly forecasts...