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")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter