Skip to content

Instantly share code, notes, and snippets.

@Karts27
Created August 31, 2021 10:36
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/c0730e6c7fac636ef8deba79b2c5a2cd to your computer and use it in GitHub Desktop.
Save Karts27/c0730e6c7fac636ef8deba79b2c5a2cd 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(2), range(2))
sns.set(font_scale = 2)
sns.heatmap(df_cnf, annot = True)
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