October 2018
Intermediate to advanced
172 pages
4h 6m
English
A normalized confusion matrix makes it easier for the data scientist to visually interpret how the labels are being predicted. In order to construct a normalized confusion matrix, we use the following code:
import matplotlib.pyplot as pltimport scikitplot as skplt#Normalized confusion matrix for the K-NN modelprediction_labels = knn_classifier.predict(X_test)skplt.metrics.plot_confusion_matrix(y_test, prediction_labels, normalize=True)plt.show()
This results in the following normalized confusion matrix:

In the preceding plot, the predicted labels are along the ...
Read now
Unlock full access