Search⌘ K
AI Features

Test the Network on a Subset

Explore how to test your trained neural network on a subset of the MNIST dataset. Understand how to query the network with unseen handwritten digit images, interpret output scores, and evaluate its classification accuracy, even when trained on limited data.

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:

Python
# 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:

Python
# 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 ...