Keras: How To Record Validation Loss
Note: this is a duplicate question, but I'm not looking for the answer. Rather, how better to find the answer myself. How do I record loss, training accuracy, testing loss and tes
Solution 1:
As detailed in the doc https://keras.io/models/sequential/#fit, when you call model.fit
, it returns a callbacks.History
object. You can get loss and other metrics from it:
...
train_history = model.fit(X_train, Y_train,
batch_size=batch_size, nb_epoch=nb_epoch,
verbose=1, validation_data=(X_test, Y_test))
loss = train_history.history['loss']
val_loss = train_history.history['val_loss']
plt.plot(loss)
plt.plot(val_loss)
plt.legend(['loss', 'val_loss'])
plt.show()
Post a Comment for "Keras: How To Record Validation Loss"