Multiclass classification

One of the popular examples of multiclass classification is to label the images of handwritten digits. The classes or labels in this examples are {0,1,2,3,4,5,6,7,8,9}. In the following example, we will use MNIST. Let's load the MNIST images as we did in the earlier chapter with the following code:

from tensorflow.examples.tutorials.mnist import input_datamnist = input_data.read_data_sets(os.path.join(    datasetslib.datasets_root, 'mnist'), one_hot=True)

If the MNIST dataset is already downloaded as per instructions from an earlier chapter, then we would get the following output:

Extracting /Users/armando/datasets/mnist/train-images-idx3-ubyte.gzExtracting /Users/armando/datasets/mnist/train-labels-idx1-ubyte.gzExtracting ...

Get Python: Advanced Guide to Artificial Intelligence now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.