Automatically created module for IPython interactive environment
Training samples (10 of 100 are shown)
[0 9 5 5 6 5 0 9 8 9 8 4 1 7 7 3 5 1 0 0 2 2 7 8 2 0 1 2 6 3 3 7 3 3 4 6 6
6 4 9 1 5 0 9 5 2 8 2 0 0 1 7 6 3 2 1 7 4 6 3 1 3 9 1 7 6 8 4 3 1 4 0 5 3
6 9 6 1 7 5 4 4 7 2 8 2 2 5 7 9 5 4 8 8 4 9 0 8 9 8]
Predictions (10 shown)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-b12338dd2b9f> in <module>()
58 images_and_predictions = list(zip(digits.images[digitsToShow:], predicted))
59 for index, (image, prediction) in enumerate(images_and_predictions[digitsToShow:]):
---> 60 plt.subplot(2, digitsToShow, index + 1)
61 plt.axis('off')
62 plt.imshow(image, cmap=plt.cm.gray_r, interpolation='nearest')
/Users/clearwhale/anaconda/lib/python3.6/site-packages/matplotlib/pyplot.py in subplot(*args, **kwargs)
1042
1043 fig = gcf()
-> 1044 a = fig.add_subplot(*args, **kwargs)
1045 bbox = a.bbox
1046 byebye = []
/Users/clearwhale/anaconda/lib/python3.6/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs)
1018 self._axstack.remove(ax)
1019
-> 1020 a = subplot_class_factory(projection_class)(self, *args, **kwargs)
1021
1022 self._axstack.add(key, a)
/Users/clearwhale/anaconda/lib/python3.6/site-packages/matplotlib/axes/_subplots.py in __init__(self, fig, *args, **kwargs)
62 raise ValueError(
63 "num must be 1 <= num <= {maxn}, not {num}".format(
---> 64 maxn=rows*cols, num=num))
65 self._subplotspec = GridSpec(rows, cols)[int(num) - 1]
66 # num - 1 for converting from MATLAB to python indexing
ValueError: num must be 1 <= num <= 20, not 21