当前位置:网站首页>【小记】BatchSize的数值是设置的越大越好吗
【小记】BatchSize的数值是设置的越大越好吗
2022-08-11 04:12:00 【Time.Xu】
BatchSize的数值并不是设置的越大越好
通常我们可能会认为设置较大的batchsize时,模型的训练效果会比较好。原因有以下几点:
1、模型由于每次得到较多的训练数据,模型的下降方向会更加准确,模型训练曲线会更加平滑。
2、减少了训练时间。同样的epoch时,batchsize需要的batch数目减少了,所以处理速度变快了。
但是啊但是,
较大的batchsize有以下几点问题需要注意:
1、内存问题。较大的batch可能会造成内存/显存溢出
2、泛化能力下降。这一点是我之前没有考虑到的一点。使用太大的批处理大小可能会在训练期间对网络的准确性产生负面影响,因为它减少了梯度下降的随机性。
使用较小的批处理大小产生更不稳定、更随机的权重更新。这有两个积极的影响。首先,它可以帮助训练“跳出”之前可能陷入的局部最小值,其次,它可以使训练稳定在“更平坦”的最小值,这通常表明泛化性能更好。
怎么选取训练神经网络时的Batch size? - 知乎 (zhihu.com)
上面这篇链接里(侵删)指出:
- 当有足够算力时,选取batch size为32或更小一些。
- 算力不够时,在效率和泛化性之间做trade-off,尽量选择更小的batch size。
- 当模型训练到尾声,想更精细化地提高成绩(比如论文实验/比赛到最后),有一个有用的trick,就是设置batch size为1,即做纯SGD,慢慢把error磨低。
边栏推荐
- Basic understanding of MongoDB (2)
- "125 Palindrome Verification" of the 10th day string series of LeetCode brushing questions
- Where can machine learning be applied?What is machine learning useful for?
- Clang Code Model: Error: The clangbackend executable “X:/clangbackend.exe“ could not be started
- leetcode刷题第13天二叉树系列之《98 BST及其验证》
- set_new_handler(0)是什么意思?有什么用?
- js 将字符串作为js执行代码使用
- LeetCode刷题第10天字符串系列之《125回文串验证》
- 【服务器安装Redis】Centos7离线安装redis
- CTO said that the number of rows in a MySQL table should not exceed 2000w, why?
猜你喜欢

【FPGA】名词缩写

Jetson Orin平台4-16路 GMSL2/GSML1相机采集套件推荐

"239 Sliding Window Maximum Value" on the 16th day of LeetCode brushing

《卫星界》刊评“星辰大海”计划:孙宇晨为太空旅游带来新的机遇

"3 Longest Substring Without Repeating Characters" on the 17th day of LeetCode brushing

The development of the massage chair control panel makes the massage chair simple and intelligent

UNI-APP_iphone bottom safe area

LeetCode Brush Questions Day 11 String Series "58 Last Word Length"

JVM 垃圾回收的概述与机制

【FPGA】day18-ds18b20实现温度采集
随机推荐
2022-08-10 The sixth group Hiding spring study notes
[Likou] 22. Bracket generation
DNS separation resolution and intelligent resolution
华南师范宋宇老师课堂对话论文翻译
【C语言】入门
LeetCode刷题第17天之《3 无重复字符的最长子串》
Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array
rub the heat - do not open
Where can machine learning be applied?What is machine learning useful for?
【服务器安装Redis】Centos7离线安装redis
Differences and connections between distributed and clustered
"239 Sliding Window Maximum Value" on the 16th day of LeetCode brushing
机器学习可以应用在哪些场景?机器学习有什么用?
Interchangeability Measurements and Techniques - Calculation of Deviations and Tolerances, Drawing of Tolerance Charts, Selection of Fits and Tolerance Classes
The development of the massage chair control panel makes the massage chair simple and intelligent
Enter the starting position, the ending position intercepts the linked list
无线电射频能量的收集
这些云自动化测试工具值得拥有
How to learn machine learning?machine learning process
直播软件搭建,流式布局,支持单选、多选等