Seaborn Confusion Matrix

PHOTO EMBED

Thu Jun 30 2022 18:17:41 GMT+0000 (Coordinated Universal Time)

Saved by @biggusdickus #python

from sklearn.metrics import confusion_matrix
import seaborn as sns
cf_matrix = confusion_matrix(train_label, sgdl1_clf_pred)
row_sums = cf_matrix.sum(axis=1, keepdims=True)
norm_conf_mx = cf_matrix / row_sums
np.fill_diagonal(norm_conf_mx, 0)
plt.figure(figsize = (50,50))
sns.heatmap(norm_conf_mx, annot=True ,linewidths=.5, cbar=False, cmap="YlGnBu")
content_copyCOPY