Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Last active August 20, 2019 17:10
Show Gist options
  • Save dipanjanS/c82ede7b51d40d5d176919fa87a1d6fa to your computer and use it in GitHub Desktop.
Save dipanjanS/c82ede7b51d40d5d176919fa87a1d6fa to your computer and use it in GitHub Desktop.
history = history1
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 4))
t = f.suptitle('Model Performance', fontsize=12)
f.subplots_adjust(top=0.85, wspace=0.3)
max_epoch = len(history.history['categorical_accuracy'])+1
epoch_list = list(range(1,max_epoch))
ax1.plot(epoch_list, history.history['categorical_accuracy'], label='Train Accuracy')
ax1.plot(epoch_list, history.history['val_categorical_accuracy'], label='Validation Accuracy')
tick_range = np.arange(0, max_epoch+1, 20)
tick_range[0] = 1
ax1.set_xticks(tick_range)
ax1.set_ylabel('Accuracy Value')
ax1.set_xlabel('Epoch')
ax1.set_title('Accuracy')
l1 = ax1.legend(loc="best")
ax2.plot(epoch_list, history.history['loss'], label='Train Loss')
ax2.plot(epoch_list, history.history['val_loss'], label='Validation Loss')
tick_range = np.arange(0, max_epoch+1, 20)
tick_range[0] = 1
ax2.set_xticks(tick_range)
ax2.set_ylabel('Loss Value')
ax2.set_xlabel('Epoch')
ax2.set_title('Loss')
l2 = ax2.legend(loc="best")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment