...

/

Test the Network on a Subset

Test the Network on a Subset

Test the network on a MNIST dataset.

Test the network

Now that we’ve trained the network, at least on a small subset of 100 records, we want to test how well that worked. We’ll do this against the second dataset, the training dataset.

First we need to get the test records, and the Python code we’ll use is very similar to what we used to get the training data:

Press + to interact
# load the mnist test data CSV file into a list
test_data_file = open("mnist_test_10.csv", 'r')
test_data_list = test_data_file.readlines()
test_data_file.close()

We unpack this data the same way as before, because it has the same structure:

Press + to interact
# load the mnist test data CSV file into a list
test_data_file = open("mnist_test_10.csv", 'r')
test_data_list = test_data_file.readlines()
test_data_file.close()
#get the first test record
all_values = test_data_list[0].split(',')
#print the label
print(all_values[0])

Before we create a loop to go through all the test records, let’s see ...

Access this course and 1400+ top-rated courses and projects.