Created
April 15, 2019 17:29
-
-
Save gabrielziegler3/e53a6dcea6dbf786f7233e1a0e4b9312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
def plot_confusion_matrix(cm, classes, normalized=True, cmap='bone'): | |
plt.figure(figsize=[5, 5]) | |
norm_cm = cm | |
if normalized: | |
norm_cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] | |
sns.heatmap(norm_cm, annot=cm, fmt='g', xticklabels=classes, yticklabels=classes, cmap=cmap) | |
plot_confusion_matrix(cm, ['producer 1', 'producer 2', 'producer 3']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
plot_confusion_matrix(cm, ['producer 1', 'producer 2', 'producer 3']) what is cm??