Skip to content
Snippets Groups Projects
Commit de4083cc authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 3eea729f
No related branches found
No related tags found
No related merge requests found
...@@ -32,14 +32,16 @@ def plot_confusion_matrix(cm, labels, title='Confusion matrix', filename = 'conf ...@@ -32,14 +32,16 @@ def plot_confusion_matrix(cm, labels, title='Confusion matrix', filename = 'conf
''' '''
if normalize: if normalize:
cm = cm.astype('float')*10 / cm.sum(axis=1)[:, np.newaxis] cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
cm *= 100
cm = np.nan_to_num(cm, copy=True) cm = np.nan_to_num(cm, copy=True)
cm = cm.astype('int') cm = cm.astype('int')
np.set_printoptions(precision=2) np.set_printoptions(precision=2)
fig = plt.figure(figsize=(3, 3), dpi=320, facecolor='w', edgecolor='k') fig = plt.figure(figsize=(3, 3), dpi=320, facecolor='w', edgecolor='k')
ax = fig.add_subplot(1, 1, 1) ax = fig.add_subplot(1, 1, 1)
im = ax.imshow(cm, cmap='Oranges') # im = ax.imshow(cm, cmap='Oranges')
im = ax.imshow(cm, cmap='Blues')
classes = [re.sub(r'([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))', r'\1 ', x) for x in labels] classes = [re.sub(r'([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))', r'\1 ', x) for x in labels]
classes = ['\n'.join(wrap(l, 40)) for l in classes] classes = ['\n'.join(wrap(l, 40)) for l in classes]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment