The Confusion Matrix
Previously, we learned how to use some calculated metrics to assess the performance of a classifier. There is another very interesting tool that can help you evaluate the performance of a multi-class classification model: the confusion matrix.
A confusion matrix is a square matrix where the number of rows and columns equals the number of distinct label values (or classes). In the columns of the matrix, we place each test label value. In the rows of the matrix, we place each predicted label value.
A confusion matrix looks like this:
In the preceding example, the first row of the confusion matrix is showing us that the model is doing the following:
- Correctly predicting class A
88
times - Predicting class A when the true value is B
3
times - Predicting class A when the true value is C
2
times
We can also see the scenario where the model is making a lot of mistakes when it is predicting...