note: duplicate question, i'm not looking answer. rather, how better find answer myself.
how record loss, training accuracy, testing loss , testing accuracy, model, across epochs? i'd plot graph shows validation loss against each epoch.
i know callback object, can called in fit(), or maybe model.history has it, examining source , docstrings wall of code me. numpy, instance, typically provides small use case example of simple implementation. , yet know answer one-liner, because question of input.
as detailed in doc https://keras.io/models/sequential/#fit, when call model.fit
, returns callbacks.history
object. can loss , other metrics 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()
Comments
Post a Comment