Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confusion matrix #97

Open
caofangzhou opened this issue Feb 2, 2021 · 0 comments
Open

confusion matrix #97

caofangzhou opened this issue Feb 2, 2021 · 0 comments

Comments

@caofangzhou
Copy link

Thank you for your outstanding work, which is worth learning from me.
I have a question for you about confusion matrices.
Can you tell me how to call the function of confusion matrices and output the picture
Thank you very much!

offline_test:
def plot_cm(cm, classes, normalize = True):
import seaborn as sns
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
print('Confusion matrix, without normalization')

ax= plt.subplot()
sns.heatmap(cm, annot=False, ax = ax); #annot=True to annotate cells

# labels, title and ticks
ax.set_xlabel('Predicted labels');ax.set_ylabel('True labels'); 
plt.xticks(rotation='vertical')
plt.yticks(rotation='horizontal')

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant