Skip to content

Instantly share code, notes, and snippets.

@darden1
Created April 16, 2018 10:56
Show Gist options
  • Save darden1/16112224fdd70f4391dca73882dbb72b to your computer and use it in GitHub Desktop.
Save darden1/16112224fdd70f4391dca73882dbb72b to your computer and use it in GitHub Desktop.
my_mlp_vs_sklearn_vs_keras.py
plt.figure(figsize=(10, 7))
plt.subplot(211)
plt.title("learning log (loss)")
plt.xlabel("epoch")
plt.ylabel("loss")
plt.plot(np.arange(len(clf.loss)), clf.loss, label="my train")
plt.plot(np.arange(len(clf.loss)), clf.val_loss, label="my test")
plt.plot(np.arange(len(history.history["loss"])), history.history["loss"], label="keras train")
plt.plot(np.arange(len(history.history["loss"])), history.history["val_loss"], label="keras test")
plt.plot(np.arange(len(clf_sk.loss_curve_)),clf_sk.loss_curve_, label="sklearn train")
plt.legend(loc="best")
plt.grid(True)
plt.subplot(212)
plt.title("learning log (accuracy)")
plt.xlabel("epoch")
plt.ylabel("accuracy")
plt.plot(np.arange(len(clf.loss)), clf.acc, label="my train")
plt.plot(np.arange(len(clf.loss)), clf.val_acc, label="my test")
plt.plot(np.arange(len(history.history["loss"])), history.history["acc"], label="keras train")
plt.plot(np.arange(len(history.history["loss"])), history.history["val_acc"], label="keras test")
plt.legend(loc="best")
plt.grid(True)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment