Keras - Plot training, validation and test set accuracy -


i want plot output of simple neural network:

model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) history = model.fit(x_test, y_test, nb_epoch=10, validation_split=0.2, shuffle=true)  model.test_on_batch(x_test, y_test) model.metrics_names 

i have plotted accuracy , loss of training , validation:

print(history.history.keys()) #  "accuracy" plt.plot(history.history['acc']) plt.plot(history.history['val_acc']) plt.title('model accuracy') plt.ylabel('accuracy') plt.xlabel('epoch') plt.legend(['train', 'validation'], loc='upper left') plt.show() # "loss" plt.plot(history.history['loss']) plt.plot(history.history['val_loss']) plt.title('model loss') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'validation'], loc='upper left') plt.show() 

now want add , plot test set's accuracy model.test_on_batch(x_test, y_test), model.metrics_names obtain same value 'acc' utilized plotting accuracy on training data plt.plot(history.history['acc']). how plot test set's accuracy?

it same because training on test set, not on train set. don't that, train on training set:

history = model.fit(x_test, y_test, nb_epoch=10, validation_split=0.2, shuffle=true) 

change into:

history = model.fit(x_train, y_train, nb_epoch=10, validation_split=0.2, shuffle=true) 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -