How to return history of validation loss in Keras

后端 未结 10 885
忘掉有多难
忘掉有多难 2020-12-02 16:37

Using Anaconda Python 2.7 Windows 10.

I am training a language model using the Keras exmaple:

print(\'Build model...\')
model = Sequential()
model.ad         


        
相关标签:
10条回答
  • 2020-12-02 17:29

    Thanks to Alloush,

    Following parameter must be included in model.fit():

    validation_data = (x_test, y_test)
    

    If it is not defined, val_acc and val_loss will not be exist at output.

    0 讨论(0)
  • 2020-12-02 17:31

    The dictionary with histories of "acc", "loss", etc. is available and saved in hist.history variable.

    0 讨论(0)
  • 2020-12-02 17:33

    Another option is CSVLogger: https://keras.io/callbacks/#csvlogger. It creates a csv file appending the result of each epoch. Even if you interrupt training, you get to see how it evolved.

    0 讨论(0)
  • 2020-12-02 17:37

    Just an example started from

    history = model.fit(X, Y, validation_split=0.33, nb_epoch=150, batch_size=10, verbose=0)
    

    You can use

    print(history.history.keys())
    

    to list all data in history.

    Then, you can print the history of validation loss like this:

    print(history.history['val_loss'])
    
    0 讨论(0)
提交回复
热议问题