This scenario is an introduction to how to use TensorFlow when building a simple neural network architecture, training the model and evaluate the results. We will be working on the MNIST dataset. We will be solving the classification task and try to recognise the actual digit from its handwritten representation.
TensorFlow has the dataset already built in, so there is no need to manually download it.
To start working with MNIST let us include some necessary imports:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # Read data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
The code uses built-in capabilities of TensorFlow to download the dataset locally and load it into the python variable. As a result (if not specified otherwise), the data will be downloaded into the
We are also defining some of the values that will be use further in the code:
image_size = 28 labels_size = 10 learning_rate = 0.05 steps_number = 1000 batch_size = 100