当前位置:网站首页>5.过拟合,dropout,正则化
5.过拟合,dropout,正则化
2022-07-07 23:11:00 【booze-J】
过拟合
过拟合导致测试误差变大:
可以看到图中随着模型结构的越来越复杂,训练集的误差越来越小,测试集的误差先变小后变大,过拟合导致测试误差变大。
比较好的情况是训练误差和测试误差这两条线比较接近。
防止过拟合
1.增大数据集
数据挖掘领域流行着这样一句话,“有时候拥有更多的数据胜过一个好的模型”。一般来说更多的数据参与训练,训练得到的模型就越好。如果数据太少,而我们构建的神经网络又太复杂的话就比较容易产生过拟合的现象。
2.Early stopping
在训练模型的时候,我们往往会设置一个比较大的选代次数。Early stopping便是一种提前结束训练的策略用来防止过拟合。
一般的做法是记录到目前为止最好的validation accuracy,当连续10个Epoch没有达到最佳accuracy时,则可以认为accuracy不再提高了。此时便可以停止迭代了(Early Stopping)。
3.Dropout
每次训练的时候,都会随机的去关闭一些神经元,关闭的意思并不是去掉,而是这些画虚线的神经元不参与训练。注意一般训练完,测试模型的时候,是使用所有神经元,不会进行dropout。
4.正则化
C0代表原始的代价函数,n代表样本的个数, λ \lambda λ就是正则项系数,权衡正则项与C0项的比重。
L1正则化:
L1正则化可以达到模型参数稀疏化的效果。
L2正则化:
L2正则化可以使得模型的权值衰减,使模型参数值都接近于0。
当 λ \lambda λ=0.001时,出现了过拟合现象,当 λ \lambda λ=0.01时,有较轻微的过拟合,当 λ \lambda λ=0.1的时候没有出现过拟合现象。
边栏推荐
- Codeforces Round #804 (Div. 2)(A~D)
- Is it safe to speculate in stocks on mobile phones?
- 新库上线 | 中国记者信息数据
- 他们齐聚 2022 ECUG Con,只为「中国技术力量」
- 从服务器到云托管,到底经历了什么?
- Hotel
- Qt不同类之间建立信号槽,并传递参数
- How can CSDN indent the first line of a paragraph by 2 characters?
- 炒股开户怎么最方便,手机上开户安全吗
- Basic principle and usage of dynamic library, -fpic option context
猜你喜欢
Kubernetes static pod (static POD)
jemter分布式
基于人脸识别实现课堂抬头率检测
1293_ Implementation analysis of xtask resumeall() interface in FreeRTOS
A network composed of three convolution layers completes the image classification task of cifar10 data set
NVIDIA Jetson test installation yolox process record
DNS 系列(一):为什么更新了 DNS 记录不生效?
第一讲:链表中环的入口结点
Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
随机推荐
【obs】官方是配置USE_GPU_PRIORITY 效果为TRUE的
Vscode software
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
The weight of the product page of the second level classification is low. What if it is not included?
Hotel
Operating system principle --- summary of interview knowledge points
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
基于人脸识别实现课堂抬头率检测
服务器防御DDOS的方法,杭州高防IP段103.219.39.x
Basic types of 100 questions for basic grammar of Niuke
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
Stock account opening is free of charge. Is it safe to open an account on your mobile phone
[OBS] the official configuration is use_ GPU_ Priority effect is true
Is it safe to speculate in stocks on mobile phones?
How can CSDN indent the first line of a paragraph by 2 characters?
Class head up rate detection based on face recognition
What has happened from server to cloud hosting?
Cancel the down arrow of the default style of select and set the default word of select
手写一个模拟的ReentrantLock