text_plain_output_1.png
from sklearn.metrics import accuracy_score,confusion_matrix

from sklearn.naive_bayes import MultinomialNB

import matplotlib.pyplot as plt

import seaborn as sns

emotions_categories = {'joy': ['joy', 'happy', 'laugh', 'excited', 'surprise'], 'sadness': ['sad', 'disappointed', 'regret', 'depressed', 'lonely'], 'anger': ['angry', 'frustrated', 'annoyed', 'irritated', 'mad'], 'fear': ['afraid', 'scared', 'fear', 'terrified', 'nervous']}

clf = MultinomialNB()

clf.fit(xtrain, ytrain)

ypred = clf.predict(xtest)

conf_matrix = confusion_matrix(ytest, ypred)

plt.style.use('dark_background')
plt.figure(figsize=(15, 8))
sns.heatmap(conf_matrix, annot=True, cmap='hot', xticklabels=emotions_categories.values(), yticklabels=emotions_categories.values())
plt.xlabel('PREDICTION')
plt.ylabel('ACTUAL')
plt.show()