April 2018
Beginner to intermediate
300 pages
7h 34m
English
Similar to what we did at the beginning of this chapter, we will draw the digit images out. This time, we pick out the mislabeled ones because they are the ones we're concerned about. We will again pick 10 images and put them in a grid of subplots. We write the true label in green at the bottom as xlabel and the false label predicted in red as the title at the top for each image in a subplot:
import matplotlib.pyplot as pltnrows, ncols = 2, 5plt.figure(figsize=(6,3))for i in range(ncols * nrows): j = mislabeled_indices[i] ax = plt.subplot(nrows, ncols, i + 1) ax.imshow(X_test[j].reshape(8,8),cmap='gray_r') plt.xticks([]) plt.yticks([]) plt.title(y_test1[j],color='red') plt.xlabel(y_test[j],color='green') ...
Read now
Unlock full access