当前位置:网站首页>交叉验证如何防止过拟合
交叉验证如何防止过拟合
2022-07-06 17:35:00 【ZEERO~】
1、过拟合与欠拟合定义
过拟合指的是模型在训练集上表现很好,在验证集和测试集上表现很差;
欠拟合指的是模型在训练集、测试集、验证集上表现都很差。
2、过拟合与欠拟合出现的原因分析
2.1 样本数量
我们知道,样本数量对于机器学习算法来说,假如模型适用于大数据集,那么样本数量必然是越多越好。当样本数量不足时,会出现欠拟合情况,模型在三个数据集上表现都非常差。
2.2 模型复杂度
通常来说,当我们选定模型后,例如逻辑回归,线性回归,使用的特征数量越多,模型复杂度通常就会越高。我们可以利用特征选择算法,例如MRMR、卡方检验,将特征重要性进行排序。然后依次增加特征,计算训练集和测试集的准确率和损失函数。我们一般会发现,随着特征数量的增加,训练集的准确率会逐渐趋于100%,测试集的准确率会逐渐下降。训练集的损失会逐渐下降为0,测试集的损失会逐渐增加。例如说,当训练集损失为0,而测试集损失不为0时,我们知道模型必然发生了过拟合。这样,我们就能大致判断当前模型是否发生了过拟合情况。
3、为何交叉验证可以防止过拟合
首先要说明的一点是,并不是交叉验证会使得模型复杂度降低或者怎么样而防止模型过拟合,而是说交叉验证这种行为可以让我们在训练过程中评估模型是否出现了过拟合情况。
我们知道,5折交叉验证是随机用80%的数据进行训练,20%的数据进行验证。这种情况下,如果模型发生了过拟合,
边栏推荐
- Telerik UI 2022 R2 SP1 Retail-Not Crack
- "Exquisite store manager" youth entrepreneurship incubation camp - the first phase of Shunde market has been successfully completed!
- NEON优化:log10函数的优化案例
- How to manage distributed teams?
- Tensorflow GPU installation
- 身体质量指数程序,入门写死的小程序项目
- [Niuke] b-complete square
- 斗地主游戏的案例开发
- LLDP兼容CDP功能配置
- [JS] obtain the N days before and after the current time or the n months before and after the current time (hour, minute, second, year, month, day)
猜你喜欢
随机推荐
前置机是什么意思?主要作用是什么?与堡垒机有什么区别?
微信公众号发送模板消息
Wood extraction in Halcon
docker 方法安装mysql
There is an error in the paddehub application
2022 Google CTF SEGFAULT LABYRINTH wp
Informatics Olympiad YBT 1171: factors of large integers | 1.6 13: factors of large integers
云呐|工单管理软件,工单管理软件APP
"Exquisite store manager" youth entrepreneurship incubation camp - the first phase of Shunde market has been successfully completed!
系统休眠文件可以删除吗 系统休眠文件怎么删除
7.6模拟赛总结
How to evaluate load balancing performance parameters?
接收用户输入,身高BMI体重指数检测小业务入门案例
Part VI, STM32 pulse width modulation (PWM) programming
负载均衡性能参数如何测评?
The cost of returning tables in MySQL
from .cv2 import * ImportError: libGL.so.1: cannot open shared object file: No such file or direc
Do you understand this patch of the interface control devaxpress WinForms skin editor?
windows安装mysql8(5分钟)
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform