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_data mnist = 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.gz Extracting /Users/armando/datasets/mnist/train-labels-idx1-ubyte.gz Extracting /Users/armando/datasets/mnist/t10k-images-idx3-ubyte.gz Extracting /Users/armando/datasets/mnist/t10k-labels-idx1-ubyte.gz
Now let's set some parameters, as shown in the following code:
num_outputs = 10 # 0-9 digits num_inputs = 784 # total pixels...