深度神经网络中的交叉验证 [英] Cross validation in deep neural networks

查看:230
本文介绍了深度神经网络中的交叉验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何在深度神经网络中执行交叉验证?我知道执行交叉验证将训练除一个折叠以外的所有折叠,并在排除的折叠上对其进行测试。然后将其折叠k次,然后平均每次折叠的累加次数。您如何针对每次迭代执行此操作。您是否在每次折叠时都更新参数?还是对每个迭代执行k倍交叉验证?还是每次训练都在所有折叠上进行,但一次折叠被视为一次迭代?

How do you perform cross-validation in a deep neural network? I know that to perform cross validation to will train it on all folds except one and test it on the excluded fold. Then do this for k fold times and average the accuries for each fold. How do you do this for each iteration. Do you update the parameters at each fold? Or you perform k-fold cross validation for each iteration? Or is each training on all folds but one fold considered as one iteration?

推荐答案

交叉验证是ML中防止过度拟合的一种通用技术。在深度学习模型上进行操作与在线性回归上进行操作之间没有区别。所有ML模型的想法都是相同的。您在问题中描述的CV背后的基本思想是正确的。

Cross-validation is a general technique in ML to prevent overfitting. There is no difference between doing it on a deep-learning model and doing it on a linear regression. The idea is the same for all ML models. The basic idea behind CV, you described in your question is correct.

但是问题您如何在每次迭代中做到这一点并不能解决问题感。 CV算法中没有任何内容与训练期间的迭代相关。您训练了模型,然后才对其进行评估。

But the question how do you do this for each iteration does not make sense. There is nothing in CV algorithm that relates to iterations while training. You trained your model and only then you evaluate it.

是否在每次折叠时都更新参数?。您会训练相同的模型k次,并且很可能每次都将使用不同的参数。

Do you update the parameters at each fold?. You train the same model k-times and most probably each time you will have different parameters.

CV的答案是DL中不需要的是错误的。 CV的基本思想是更好地估计模型在有限数据集上的表现。因此,如果您的数据集很小,则训练k个模型的能力将为您提供更好的估计(缩小尺寸是您将花费的时间增加了k倍)。如果您有1亿个示例,则很可能已经设置了5%的测试/验证,这将为您带来一个不错的估计。

The answer that CV is not needed in DL is wrong. The basic idea of CV is to have a better estimate of how your model is performing on a limited dataset. So if your dataset is small the ability to train k models will give you a better estimate (the downsize is that you spend ~k times more time). If you have 100mln examples, most probably having 5% testing/validation set will already give you a good estimate.

这篇关于深度神经网络中的交叉验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆