How to get the best model when using EarlyStopping callback in Keras?

后端 未结 2 1592
栀梦
栀梦 2020-12-10 21:12

I am training a neural network with Keras using EarlyStopping based on val_acc and patience=0. EarlyStopping stops the tr

相关标签:
2条回答
  • 2020-12-10 21:30

    In Keras 2.2.3, a new argument called restore_best_weights have been introduced for EarlyStopping callback that if set to True (defaults to False), it would restore the weights from the epoch with the best monitored quantity:

    restore_best_weights: whether to restore model weights from the epoch with the best value of the monitored quantity. If False, the model weights obtained at the last step of training are used.

    0 讨论(0)
  • 2020-12-10 21:51

    If you would like to save the highest accuracy then you should set the checkpoint monitor='val_acc' it will automatically save on highest. Lowest loss might not necessarily correspond to highest accuracy. You can also set verbose=1 to see which model is being saved and why.

    0 讨论(0)
提交回复
热议问题