当前位置:网站首页>交叉验证如何防止过拟合
交叉验证如何防止过拟合
2022-07-06 17:35:00 【ZEERO~】
1、过拟合与欠拟合定义
过拟合指的是模型在训练集上表现很好,在验证集和测试集上表现很差;
欠拟合指的是模型在训练集、测试集、验证集上表现都很差。
2、过拟合与欠拟合出现的原因分析
2.1 样本数量
我们知道,样本数量对于机器学习算法来说,假如模型适用于大数据集,那么样本数量必然是越多越好。当样本数量不足时,会出现欠拟合情况,模型在三个数据集上表现都非常差。
2.2 模型复杂度
通常来说,当我们选定模型后,例如逻辑回归,线性回归,使用的特征数量越多,模型复杂度通常就会越高。我们可以利用特征选择算法,例如MRMR、卡方检验,将特征重要性进行排序。然后依次增加特征,计算训练集和测试集的准确率和损失函数。我们一般会发现,随着特征数量的增加,训练集的准确率会逐渐趋于100%,测试集的准确率会逐渐下降。训练集的损失会逐渐下降为0,测试集的损失会逐渐增加。例如说,当训练集损失为0,而测试集损失不为0时,我们知道模型必然发生了过拟合。这样,我们就能大致判断当前模型是否发生了过拟合情况。
3、为何交叉验证可以防止过拟合
首先要说明的一点是,并不是交叉验证会使得模型复杂度降低或者怎么样而防止模型过拟合,而是说交叉验证这种行为可以让我们在训练过程中评估模型是否出现了过拟合情况。
我们知道,5折交叉验证是随机用80%的数据进行训练,20%的数据进行验证。这种情况下,如果模型发生了过拟合,
边栏推荐
- In rails, when the resource creation operation fails and render: new is called, why must the URL be changed to the index URL of the resource?
- 界面控件DevExpress WinForms皮肤编辑器的这个补丁,你了解了吗?
- [100 cases of JVM tuning practice] 05 - Method area tuning practice (Part 2)
- 【JVM调优实战100例】04——方法区调优实战(上)
- golang中的Mutex原理解析
- windows安装mysql8(5分钟)
- taro3.*中使用 dva 入门级别的哦
- 线段树(SegmentTree)
- Lldp compatible CDP function configuration
- Part V: STM32 system timer and general timer programming
猜你喜欢
随机推荐
Do you understand this patch of the interface control devaxpress WinForms skin editor?
The cost of returning tables in MySQL
tensorflow 1.14指定gpu运行设置
Lldp compatible CDP function configuration
Atomic in golang, and cas Operations
自旋与sleep的区别
[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)
golang中的atomic,以及CAS操作
from .cv2 import * ImportError: libGL.so.1: cannot open shared object file: No such file or direc
Build your own website (17)
Deep learning framework TF installation
Send template message via wechat official account
Boot - Prometheus push gateway use
Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version
Meet in the middle
Telerik UI 2022 R2 SP1 Retail-Not Crack
Neon Optimization: an instruction optimization case of matrix transpose
Gazebo的安装&与ROS的连接
ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
c语言—数组