Skip to content

Instantly share code, notes, and snippets.

@peet-droid
Created December 17, 2022 14:53
Show Gist options
  • Save peet-droid/b73e6d086127969cf00d09a4a05cf91f to your computer and use it in GitHub Desktop.
Save peet-droid/b73e6d086127969cf00d09a4a05cf91f to your computer and use it in GitHub Desktop.
It creates the Confusion matrix
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import seaborn as sn
cfm = confusion_matrix(y_true, y_pred)
classes = ['door_close', 'door_open', 'door_stop', 'unknown']
df_cfm = pd.DataFrame(cfm, index = classes, columns = classes)
plt.figure(figsize = (10,7))
cfm_plot = sn.heatmap(df_cfm, annot=True)
cfm_plot.figure.savefig("cfm.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment