Skip to content

Instantly share code, notes, and snippets.

@AI-MOO
Last active May 6, 2022 09:39
Show Gist options
  • Save AI-MOO/b51986802604e948e6f0bccc80a48d9b to your computer and use it in GitHub Desktop.
Save AI-MOO/b51986802604e948e6f0bccc80a48d9b to your computer and use it in GitHub Desktop.
# استيراد المكتبات
from sklearn.metrics import confusion_matrix
import seaborn as sns
# Confusion Matrix استخراج قيم مصفوفة الدقة
cm = confusion_matrix(y_test, SVC_prediction, normalize='true')
# Heat Map تصوير المفوفة عن طريق الخريطة الحرارية
fig, ax = plt.subplots(figsize=(14,7))
sns.set(font_scale=3.0) # Adjust to fit
sns.heatmap(cm, annot=True, annot_kws={"fontsize":15}, cmap="Blues", fmt=".3f", ax=ax);
# Heat Map تفضيلات الخريطة الحرارية
label_font = {'size':'15'}
ax.set_xlabel('Predicted labels', fontdict=label_font);
ax.set_ylabel('Actual labels', fontdict=label_font);
title_font = {'size':'20'}
ax.set_title('Confusion Matrix', fontdict=title_font);
ax.tick_params(axis='both', which='major', labelsize=10)
ax.xaxis.set_ticklabels(clf.classes_ , rotation = 25);
ax.yaxis.set_ticklabels(clf.classes_, rotation=0.5);
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment