4) Recalling a Naive Bayesian Classifier for Classification.

This Blog entry is from the Naive Bayesian section in Learn R.

To recall the pivotal classification, rather than recall P for each class and drive it from the larger of the values, the type class can be specified:

ClassPredictions <- predict(BayesianModel,CreditRisk,type = "class")
1.png

Run the line of script to console:

2.png

Merge the classification predictions into the CreditRisk data frame, specifying the dply library also:

library(dplyr)
CreditRisk <- mutate(CreditRisk, ClassPredictions)
3.png

Run the line of script to console:

4.png

Viewing the CreditRisk data frame:

View(CreditRisk)
5.png

Run the line of script to console:

6.png

Scroll to the last column in the RStudio viewer to reveal the classification for each record:

7.png