Skip to content

Instantly share code, notes, and snippets.

@Karts27

Karts27/cm.py Secret

Last active September 14, 2021 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Karts27/d5e27c5acf2fcd5ecfca4cd97199e0f3 to your computer and use it in GitHub Desktop.
Save Karts27/d5e27c5acf2fcd5ecfca4cd97199e0f3 to your computer and use it in GitHub Desktop.
#Plotting a confusion matrix for checking the performance of our model
Y_pred = np.argmax(model.predict(X_test), axis = 1)
cnf = confusion_matrix(y_test.argmax(axis = 1), Y_pred)
df_cnf = pd.DataFrame(cnf, range(28), range(28))
sns.set(font_scale = 2)
plt.figure(figsize = (25, 20))
sns.heatmap(df_cnf, annot = True, linewidths = 0.8, fmt = '0.3g', cbar = False)
plt.title("Confusion Matrix")
plt.xlabel("True Values")
plt.ylabel("Prediction Values")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment