Session Ready
Exercise

Compute confusion matrix

As discussed in the previous video, there are a number of different metrics by which you can measure the performance of a classification model. In this exercise, we will evaluate the performance of the model using test set classification error. A confusion matrix is a convenient way to examine the per-class error rates for all classes at once.

The confusionMatrix() function from the caret package prints both the confusion matrix and a number of other useful classification metrics such as "Accuracy" (fraction of correctly classified instances).

The caret package has been loaded for you.

Instructions
100 XP
  • Generate class predictions for the credit_test data frame using the credit_model object.
  • Using the caret::confusionMatrix() function, compute the confusion matrix for the test set.