Does EarlyStopping in Keras save the best model?

后端 未结 3 348
悲哀的现实
悲哀的现实 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:42

    I would say model uses the latest weights, but I could not find any evidence in the docs. Fortunately you can check the behavior of model by yourself.

    First you run:

    y_pred = model.predict(x_test)
    

    After that, you can load best-weights.h5 and run the prediction on the same test set again.

    If model contains the latest weights, you should get an improved result when loading best-weights.h5. If the results are the same, you can be sure that model automatically uses the best achieved results.

提交回复
热议问题