Skip to content

Instantly share code, notes, and snippets.

@naenumtou
Last active November 22, 2020 08:40
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 naenumtou/f1ba64dd8c33fc8e1a9774bb3719721c to your computer and use it in GitHub Desktop.
Save naenumtou/f1ba64dd8c33fc8e1a9774bb3719721c to your computer and use it in GitHub Desktop.
#Prediction and performance
from sklearn.metrics import confusion_matrix
pred = model.predict(Xtrain_idx).argmax(axis = 1)
cf_matrix = confusion_matrix(np.array(df['Categories']), pred)
#Plot confusion matrix
plt.figure(figsize = (12,8))
plt.title('Confusion matrix')
sns.heatmap(cf_matrix, annot = True, fmt = '.0f', cmap = plt.cm.Blues)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment