The Confusion Matrix
You encountered the confusion matrix in Chapter 3, Binary Classification. You may recall that the confusion matrix compares the number of classes that the model predicted against the actual occurrences of those classes in the validation dataset. The output is a square matrix that has the number of rows and columns equal to the number of classes you are predicting. The columns represent the actual values, while the rows represent the predictions. You get a confusion matrix by using confusion_matrix
from sklearn.metrics
.
Exercise 6.06: Generating a Confusion Matrix for the Classification Model
The goal of this exercise is to create a confusion matrix for the classification model you trained in Exercise 6.05, Creating a Classification Model for Computing Evaluation Metrics.
Note
You should continue this exercise in the same notebook as that used in Exercise 6.05, Creating a Classification Model for Computing Evaluation Metrics. If you wish to use a new...