-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowdata.py
More file actions
22 lines (19 loc) · 845 Bytes
/
showdata.py
File metadata and controls
22 lines (19 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Visualizes the supplied 2-d training matrix.
from matplotlib import pyplot as plt
from showdigit import showdigit
def showdata(data, predicted, expected):
# Plot the prediction
fig = plt.figure(figsize=(6, 6)) # figure size in inches
# fig.suptitle('KKK', fontsize=16)
fig.subplots_adjust(left=0, right=1, bottom=0,
top=1, hspace=0.05, wspace=0.05)
# plot the digits: each image is 8x8 pixels
for i in range(len(data)):
ax = fig.add_subplot(32, 32, i + 1, xticks=[], yticks=[])
ddd = showdigit(data[i], 32)
if predicted[i] == expected[i]:
ax.imshow(ddd, cmap=plt.cm.binary,
interpolation='nearest')
else:
ax.imshow(ddd, cmap=plt.cm.gist_heat,
interpolation='nearest')