Keras - Plot training, validation and test set accuracy
Try
pd.DataFrame(history.history).plot(figsize=(8,5))
plt.show()
This builds a graph with the available metrics of the history for all datasets of the history. Example:
It is the same because you are training on the test set, not on the train set. Don't do that, just train on the 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)
import keras
from matplotlib import pyplot as plt
history = model1.fit(train_x, train_y,validation_split = 0.1, epochs=50, batch_size=4)
plt.plot(history.history['acc'])
plt.plot(history.history['val_acc'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['train', 'val'], loc='upper left')
plt.show()
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'val'], loc='upper left')
plt.show()