Advertisement
Guest User

asdas

a guest
Apr 4th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. train_acc = model.evaluate(x_train, y_train, batch_size=32)
  2. test_acc = model.evaluate(x_test, y_test, batch_size=32)
  3.  
  4. fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(18, 10))
  5. ax1.plot(model.fit(x_train, y_train, epochs=50, batch_size=32).history['loss'], color='b', label="Training loss : {:0.4f}".format(train_acc[0]))
  6. ax1.plot(model.fit(x_train, y_train, epochs=50, batch_size=32).history['val_loss'], color='r', label="validation loss : {:0.4f}".format(test_acc[0]))
  7. ax1.set_xticks(np.arange(1, 50, 1))
  8. ax1.set_yticks(np.arange(0, 1., 0.1))
  9. ax1.legend()
  10.  
  11. ax2.plot(model.fit(x_train, y_train, epochs=50, batch_size=32).history['accuracy'], color='b', label="Training accuracy : {0:.4f}".format(train_acc[1]))
  12. ax2.plot(model.fit(x_train, y_train, epochs=50, batch_size=32).history['val_accuracy'], color='r',label="Validation accuracy : {0:.4f}".format(test_acc[1]))
  13. ax2.set_xticks(np.arange(1, 50, 1))
  14. ax2.set_yticks(np.arange(0.4, 1.2, 0.1))
  15.  
  16. legend = plt.legend(loc='best', shadow=True)
  17. plt.tight_layout()
  18. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement