concept confusion matrix in category R

appears as: confusion matrix, A confusion matrix, Confusion matrices, confusion matrices
Machine Learning with R, the tidyverse, and mlr

This is an excerpt from Manning's book Machine Learning with R, the tidyverse, and mlr.

Calculating a confusion matrix

To get a better idea of which groups are being correctly classified and which are being misclassified, we can construct a confusion matrix. A confusion matrix is simply a tabular representation of the true and predicted class of each case in the test set.

With mlr, we can calculate the confusion matrix using the calculateConfusionMatrix() function. The first argument is the $pred component of our holdoutCV object, which contains the true and predicted classes of the test set. The optional argument relative asks the function to show the proportion of each class in the true and predicted class labels: