Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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
You can’t perform that action at this time.