Skip to content

Instantly share code, notes, and snippets.

@dead
Created June 3, 2017 03:44
Show Gist options
  • Save dead/29f5e4433f888caf3ef51e0b56455c9a to your computer and use it in GitHub Desktop.
Save dead/29f5e4433f888caf3ef51e0b56455c9a to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
def plot_model_history(h, mode="loss"):
legend = [mode]
x = range(len(h[mode]))
plt.plot(x, h[mode], marker='.')
if "val_" + mode in h:
legend.append("val_" + mode)
plt.plot(x, h["val_" + mode], marker='.')
plt.xlabel('Epochs')
plt.title(mode + ' over epochs')
plt.legend(legend, loc = 'center right', bbox_to_anchor=(1.3, 0.5))
plt.show()
@lucasghelal
Copy link

No jupyter antes do import usar:
%matplotlib inline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment