May 2020
Beginner to intermediate
430 pages
10h 39m
English
The line plot showing training accuracy and training loss per epoch is shown using the Python matplotlib function. We will import matplotlib first and then define parameters for training and validation loss and accuracy:
import matplotlib.pyplot as pltacc = history.history['accuracy']val_acc = history.history['val_accuracy']loss = history.history['loss']val_loss = history.history['val_loss']
The following code is standard for plotting the model output with Keras and TensorFlow. We first define the figure size (8 x 8) and use the subplot function shows (2,1,1) and (2,1,2). We then define the label, limit, and title:
plt.figure(figsize=(8, 8))plt.subplot(2, 1, 1)plt.plot(acc, label='Training Accuracy')plt.plot(val_acc, ...