Book Image

Mastering Probabilistic Graphical Models with Python

By : Ankur Ankan
Book Image

Mastering Probabilistic Graphical Models with Python

By: Ankur Ankan

Overview of this book

Table of Contents (14 chapters)
Mastering Probabilistic Graphical Models Using Python
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

The Naive Bayes model


The Naive Bayes model is one of the most efficient and effective learning algorithms, particularly in the field of text classification. Although over-simplistic, this model has worked out quite well. In this section, we are going to discuss the following topics:

  • What is a Naive Bayes model?

  • Why does it even work?

  • Types of Naive Bayes models

Before discussing the Naive Bayes model, let's first discuss about the Bayesian classifier. A Bayesian classifier is a probabilistic classifier that uses the Bayes theorem to predict a class. Let c be a class and be a set of features. Then, the probability of the features belonging to class c, that is , can be computed using the Bayes theorem as follows:

So, for a given set of features, the output class can be predicted as follows:

Here, P(c) is the prior probability of the class c and is the likelihood of X given c. If X were an univariate feature, then computing would be , which is easier to compute. However, in the case of multivariate...