Does EarlyStopping in Keras save the best model?

后端 未结 3 346
悲哀的现实
悲哀的现实 2021-01-18 05:48

When using something like:

callbacks = [
    EarlyStopping(patience=15, monitor=\'val_loss\', min_delta=0, mode=\'min\'),
    ModelCheckpoint(\'best-weights.         


        
3条回答
  •  执笔经年
    2021-01-18 06:50

    EarlyStopping callback doesn't save anything on its own (you can double check it looking at its source code https://github.com/keras-team/keras/blob/master/keras/callbacks.py#L458). Thus your code saves the last model that achieved the best result on dev set before the training was stopped by the early stopping callback. I would say that, if you are saving only the best model according to dev, it is not useful to have also an early stopping callback (unless you don't want to save time and your are sure enough you are not going to find any better model if you continue the training)

提交回复
热议问题