Book Image

Clojure for Data Science

By : Henry Garner
Book Image

Clojure for Data Science

By: Henry Garner

Overview of this book

Table of Contents (18 chapters)
Clojure for Data Science
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Naive Bayes classification


The reason that the answer we arrived at using Bayes theorem and the actual result differ slightly is that by using Bayes rule we made an assumption when calculating that the probability of being male, and the probability of being in third class, are independent. In the next section, we'll use Bayes theorem to produce a naive Bayes classifier.

Note

The reason this algorithm is called naive is because it assumes all variables are independent. We know this is often not the case, and there are interaction effects between variables. For example, we might know that combinations of parameters make a certain class very much more likely—for example, being both male and in third class.

Let's look at how we might use Bayes rule for a classifier. The Bayes theorem for two possible classes, survive and perish, are shown as follows for a male in third class:

The most likely class will be the one with the greatest posterior probability.

appears as the common factor for both classes...