text_plain_output_1.png
import matplotlib.pyplot as plt
plt.figure(figsize=(16, 7))
acc = history.history['accuracy']
val_acc = history.history['val_accuracy']
loss = history.history['loss']
val_loss = history.history['val_loss']
epochs = range(1, len(acc) + 1)
ax1 = plt.subplot(1, 2, 1)
ax1.plot(epochs, acc, 'r')
ax1.plot(epochs, val_acc, 'b')
ax1.set_xticks([i for i in epochs])
ax1.set_title('Training and validation Accuracy')
ax1.legend(['Training', 'Validation'])
ax1.set_xlabel('epochs')
ax1.set_ylabel('Accuracy')
ax2 = plt.subplot(1, 2, 2)
ax2.plot(epochs, loss, 'r')
ax2.plot(epochs, val_loss, 'b')
ax2.set_xticks([i for i in epochs])
ax2.legend(['Training', 'Validation'])
ax2.set_xlabel('Epochs')
ax2.set_ylabel('Loss')
ax2.set_title('Training and validation loss')
plt.show()