The MNIST database of handwritten digits (from 0 to 9) has a training set of 55,000
examples, and a test set of 10,000 examples. The digits have been size-normalized and
centered in a fixed-size image (28×28 pixels) with values from 0 to 1. You can use the
following code with TensorFlow in Python to download the data.
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
Every MNIST data point has two parts: an image of a handwritten digit and a
corresponding label. We will call the images ? and the labels ?. Both the training set and
test set contain ? and ?.
Each image is 28 pixels by 28 pixels and can be flattened into a vector of 28×28 = 784
As mentioned, the corresponding labels in the MNIST are numbers between 0 and 9,
describing which digit a given image is of. In this assignment, we regard the labels as
one-hot vectors, i.e. 0 in most dimensions, and 1 in a single dimension. In this case,
the ?-th digit will be represented as a vector which is 1 in the ? dimensions. For
example, 3 would be [0,0,0,1,0,0,0,0,0,0].
The assignment aims to build NNs for classifying handwritten digits in the MNIST
database, train it on the training set and test it on the test set.
Please read the following comments and requirements very carefully before starting the
1. The assignment is based on the content of Labs.
2. In Lecture 1, we talked about the use of training set, validation set and test set
in machine learning. In the assignment, you are asked to train the NN on the
training set and test the NN on the test set, instead of doing the two steps on the
same data set as what was done in Lab 5. You do NOT need the validation set in
3. In the assignment, the performance of a NN is measured by the its prediction
accuracy in classifying images from the test set, i.e. number of the correctly
predicted images / number of the images in the test set.
4. You are asked to model THREE NNs by changing the architecture. For example,
you may change the number of layers, use different type of layers, and try
various activation layers.
5. You are encouraged to repeatedly train and test your NNs with different
parameter setting, e.g. learning rate.
6. Your report MUST at least contain the following content
a. Names and student numbers of all group members;