Activity 4 - Training the Model

Workshop Resources

The following code determines how many times model is trained. It is normal for this segment of code to take longer than usual to run.

model.fit(train_images, train_labels, epochs=10) 

Epochs represent the number of times the model processes all the training data.

The following code prints out the overall test accuracy.

test_loss, test_acc = model.evaluate(test_images,  test_labels, verbose=2)

print('\nTest accuracy:', test_acc)

Question 1

Set the value of epochs equal to 2. What is the accuracy of the last epoch? What is the test accuracy when the trained model is compared to the test dataset?

Question 2

Set the value of epochs equal to 10. Repeat Question 1.

Question 3

Set the value of epochs equal to 20. Repeat Question 1.

Question 4

What correlation do you see when you increase the number of epochs? Does the accuracy increase or decrease?