import seaborn as sns from sklearn.metrics import confusion_matrix as cm conf_mat = cm(y_true, y_pred) sns.heatmap(conf_mat, annot=True)