Commit 96ed0209 authored by Gunasinghe M.D.'s avatar Gunasinghe M.D.

visualization

parent 81f184ec
import matplotlib.pyplot as plt
import numpy as np
def plot_model_history(model_history):
fig, axs = plt.subplots(1, 2, figsize=(15, 5))
# summarize history for accuracy
axs[0].plot(range(1, len(model_history.history['acc']) + 1),
model_history.history['acc'])
axs[0].plot(range(1, len(model_history.history['val_acc']) + 1),
model_history.history['val_acc'])
axs[0].set_title('Model Accuracy')
axs[0].set_ylabel('Accuracy')
axs[0].set_xlabel('Epoch')
axs[0].set_xticks(np.arange(1, len(model_history.history[
'acc']) + 1), len(model_history.history['acc']) / 10)
axs[0].legend(['train', 'val'], loc='best')
# summarize history for loss
axs[1].plot(range(1, len(model_history.history['loss']) + 1),
model_history.history['loss'])
axs[1].plot(range(1, len(model_history.history['val_loss']) + 1),
model_history.history['val_loss'])
axs[1].set_title('Model Loss')
axs[1].set_ylabel('Loss')
axs[1].set_xlabel('Epoch')
axs[1].set_xticks(np.arange(1, len(model_history.history[
'loss']) + 1), len(model_history.history['loss']) / 10)
axs[1].legend(['train', 'val'], loc='best')
plt.show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment