restore_best_weights 问题 keras 提前停止

restore_best_weights issue keras early stopping

我正在为我的深度学习项目使用 Keras 的 EarlyStopping。文档 here 提到了一个非常有用的恢复最佳权重的想法。但不知何故我还不能使用它。我正在使用 Keras 2.2.2/TF 1.10,使用 Anaconda 安装。 调用很简单如下。有什么问题吗?

es = EarlyStopping(monitor='val_acc', min_delta=1e-4, patience=patience_,verbose=1,restore_best_weights=True)

__init__() got an unexpected keyword argument 'restore_best_weights'

啊,很普遍的问题。 keras 在线文档是从 github 的 master 分支生成的,因此最近才引入的功能在那里出现,但还没有出现在任何 Keras 版本中。

所以EarlyStopping回调的restore_best_weights选项是在2018年8月18日添加的,而目前最新的Keras版本(2.2.2)是在2018年7月28日发布的。所以你将不得不使用 Keras master,等待 Keras 发布,或者干脆不使用该选项。

更新: 它现在包含在 Keras 2.2.3 版本中。