8.5 APPLICATION OF NAÏVE BAYES CLASSIFICATION
We will use the wine_ flag_training and wine_flag_test data sets to demonstrate how we use Naïve Bayes to classify a response variable. Let us say we want to predict whether a wine is red or white based on whether the wine has high or low alcohol and sugar content. Alcohol and sugar content values are considered low if they are below the median for that variable, and high if they are above the median.
First, we construct two contingency tables, one for Type and Alcohol_flag and another for Type and Sugar_flag. Recall that the class values of target variable constitute the rows, and the class values of predictor variables constitute the columns. The contingency table for Type and Alcohol_flag is shown in Figure 8.1, while the contingency table for Type and Sugar_flag is shown in Figure 8.2.
We can use...