import numpy as np
import matplotlib.pyplot as plt
conf_arr = [[33, 2], [3, 31]]
norm_conf = []
for i in conf_arr:
    a = 0
    tmp_arr = []
    a = sum(i, 0)
    for j in i:
        tmp_arr.append(float(j) / float(a))
    norm_conf.append(tmp_arr)
fig = plt.figure()
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect(1)
res = ax.imshow(np.array(norm_conf), cmap=plt.cm.jet, interpolation='nearest')
width, height = np.array(conf_arr).shape
for x in range(width):
    for y in range(height):
        ax.annotate(str(conf_arr[x][y]), xy=(y, x), horizontalalignment=
            'center', verticalalignment='center')
cb = fig.colorbar(res)
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
plt.xticks(range(width), ['Actually Stable', 'Actually Not Stable'])
plt.yticks(range(height), ['Pred Stable', 'Pred Not Stable'])
plt.savefig('confusion_matrix.png', format='png')

60e225278c2c999b4651aa1637cff9adaa838244
<mask token>

<mask token>
for i in conf_arr:
    a = 0
    tmp_arr = []
    a = sum(i, 0)
    for j in i:
        tmp_arr.append(float(j) / float(a))
    norm_conf.append(tmp_arr)
<mask token>
plt.clf()
<mask token>
ax.set_aspect(1)
<mask token>
for x in range(width):
    for y in range(height):
        ax.annotate(str(conf_arr[x][y]), xy=(y, x), horizontalalignment=
            'center', verticalalignment='center')
<mask token>
plt.xticks(range(width), ['Actually Stable', 'Actually Not Stable'])
plt.yticks(range(height), ['Pred Stable', 'Pred Not Stable'])
plt.savefig('confusion_matrix.png', format='png')

<mask token>
conf_arr = [[33, 2], [3, 31]]
norm_conf = []
for i in conf_arr:
    a = 0
    tmp_arr = []
    a = sum(i, 0)
    for j in i:
        tmp_arr.append(float(j) / float(a))
    norm_conf.append(tmp_arr)
fig = plt.figure()
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect(1)
res = ax.imshow(np.array(norm_conf), cmap=plt.cm.jet, interpolation='nearest')
width, height = np.array(conf_arr).shape
for x in range(width):
    for y in range(height):
        ax.annotate(str(conf_arr[x][y]), xy=(y, x), horizontalalignment=
            'center', verticalalignment='center')
cb = fig.colorbar(res)
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
plt.xticks(range(width), ['Actually Stable', 'Actually Not Stable'])
plt.yticks(range(height), ['Pred Stable', 'Pred Not Stable'])
plt.savefig('confusion_matrix.png', format='png')

import numpy as np
import matplotlib.pyplot as plt
conf_arr = [[33, 2], [3, 31]]
norm_conf = []
for i in conf_arr:
    a = 0
    tmp_arr = []
    a = sum(i, 0)
    for j in i:
        tmp_arr.append(float(j) / float(a))
    norm_conf.append(tmp_arr)
fig = plt.figure()
plt.clf()
ax = fig.add_subplot(111)
ax.set_aspect(1)
res = ax.imshow(np.array(norm_conf), cmap=plt.cm.jet, interpolation='nearest')
width, height = np.array(conf_arr).shape
for x in range(width):
    for y in range(height):
        ax.annotate(str(conf_arr[x][y]), xy=(y, x), horizontalalignment=
            'center', verticalalignment='center')
cb = fig.colorbar(res)
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
plt.xticks(range(width), ['Actually Stable', 'Actually Not Stable'])
plt.yticks(range(height), ['Pred Stable', 'Pred Not Stable'])
plt.savefig('confusion_matrix.png', format='png')
