【学习笔记】深度学习技巧(防止过拟合)——Early Stopping 早停法

Early Stopping 的优缺点:
优点: 防止过拟合。
缺点: 没有采取不同的方式来解决优化损失函数和降低方差这两个问题,而是用一种方法同时解决两个问题 ,结果就是要考虑的东西变得更复杂。之所以不能独立地处理,因为如果你停止了优化代价函数,你可能会发现代价函数的值不够小,同时你又不希望过拟合。
解决办法: 尝试L1、L2正则化,dropout等。
 

代码示例:

在 FastText 中使用 early_stopping :
monitor: 需要监视的量,val_acc() (模型准确率model accuracy)
patience: 当early stop被激活(如发现 loss 相比上一个 epoch 训练没有下降),则经过 patience 个 epoch 后停止训练
verbose: 信息展示模式
mode: ‘auto’,‘min’,'max’之一,在min模式训练,如果检测值停止下降则终止训练。
在max模式下,当检测值不再上升的时候则停止训练。in auto mode, the direction is automatically inferred from the name of the monitored quantity.

转自:https://blog.csdn.net/Trance95/article/details/104934789

猜你喜欢

转载自blog.csdn.net/weixin_45223645/article/details/115798258