Skip to content

confusion matrix #97

@caofangzhou

Description

@caofangzhou

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions