当前位置:网站首页>交叉验证如何防止过拟合
交叉验证如何防止过拟合
2022-07-06 17:35:00 【ZEERO~】
1、过拟合与欠拟合定义
过拟合指的是模型在训练集上表现很好,在验证集和测试集上表现很差;
欠拟合指的是模型在训练集、测试集、验证集上表现都很差。
2、过拟合与欠拟合出现的原因分析
2.1 样本数量
我们知道,样本数量对于机器学习算法来说,假如模型适用于大数据集,那么样本数量必然是越多越好。当样本数量不足时,会出现欠拟合情况,模型在三个数据集上表现都非常差。
2.2 模型复杂度
通常来说,当我们选定模型后,例如逻辑回归,线性回归,使用的特征数量越多,模型复杂度通常就会越高。我们可以利用特征选择算法,例如MRMR、卡方检验,将特征重要性进行排序。然后依次增加特征,计算训练集和测试集的准确率和损失函数。我们一般会发现,随着特征数量的增加,训练集的准确率会逐渐趋于100%,测试集的准确率会逐渐下降。训练集的损失会逐渐下降为0,测试集的损失会逐渐增加。例如说,当训练集损失为0,而测试集损失不为0时,我们知道模型必然发生了过拟合。这样,我们就能大致判断当前模型是否发生了过拟合情况。
3、为何交叉验证可以防止过拟合
首先要说明的一点是,并不是交叉验证会使得模型复杂度降低或者怎么样而防止模型过拟合,而是说交叉验证这种行为可以让我们在训练过程中评估模型是否出现了过拟合情况。
我们知道,5折交叉验证是随机用80%的数据进行训练,20%的数据进行验证。这种情况下,如果模型发生了过拟合,
边栏推荐
猜你喜欢

golang中的Mutex原理解析

Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version

Batch obtain the latitude coordinates of all administrative regions in China (to the county level)
![[HFCTF2020]BabyUpload session解析引擎](/img/db/6003129bc16f943ad9868561a2d5dc.png)
[HFCTF2020]BabyUpload session解析引擎

Niuke cold training camp 6B (Freund has no green name level)

Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman

go-zero微服务实战系列(九、极致优化秒杀性能)

Part VI, STM32 pulse width modulation (PWM) programming

Periodic flash screen failure of Dell notebook

ESP Arduino (IV) PWM waveform control output
随机推荐
【JVM调优实战100例】04——方法区调优实战(上)
线段树(SegmentTree)
Periodic flash screen failure of Dell notebook
云呐|工单管理办法,如何开展工单管理
BFS realizes breadth first traversal of adjacency matrix (with examples)
Let's talk about 15 data source websites I often use
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
Maidong Internet won the bid of Beijing life insurance to boost customers' brand value
Dell筆記本周期性閃屏故障
[batch dos-cmd command - summary and summary] - jump, cycle, condition commands (goto, errorlevel, if, for [read, segment, extract string]), CMD command error summary, CMD error
C language - array
windows安装mysql8(5分钟)
Installation of torch and torch vision in pytorch
第三方跳转网站 出现 405 Method Not Allowed
Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version
Rainstorm effect in levels - ue5
【js】获取当前时间的前后n天或前后n个月(时分秒年月日都可)
How to evaluate load balancing performance parameters?
JTAG principle of arm bare board debugging
【JVM调优实战100例】05——方法区调优实战(下)