Bayes classifiers

This is a classification technique based on Bayes theorem with an assumption of independence among predictors. In layman's terms, a naive Bayes classifier assumes that the presence of a particular feature in a class is unrelated to the presence of any other feature. First, let's look at the HouseVotes84 dataset:

> library(mlbench)> data(HouseVotes84)> head(HouseVotes84)

The output is shown in the following screenshot:

The first variable, Class, is a binary one: republican or democrat. In addition, we have 16 traits associated with each individual. The following program calls the naiveBayes() function which computes the conditional ...

Get Hands-On Data Science with Anaconda now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.