Skip to content

Instantly share code, notes, and snippets.

@gabrielziegler3
Created April 15, 2019 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielziegler3/e53a6dcea6dbf786f7233e1a0e4b9312 to your computer and use it in GitHub Desktop.
Save gabrielziegler3/e53a6dcea6dbf786f7233e1a0e4b9312 to your computer and use it in GitHub Desktop.
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'])
@purviprajapati196
Copy link

plot_confusion_matrix(cm, ['producer 1', 'producer 2', 'producer 3']) what is cm??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment