当前位置:网站首页>【小记】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磨低。
边栏推荐
- 洛谷P2580 于是他错误的点名开始了
- MYSQLg advanced ------ clustered and non-clustered indexes
- 华南师范宋宇老师课堂对话论文翻译
- Multi-serial port RS485 industrial gateway BL110
- 机器学习可以应用在哪些场景?机器学习有什么用?
- WPF DataGrid 使用数据模板(2)
- MySQL database storage engine and database creation, modification and deletion
- Get the length of the linked list
- Day20 FPGA 】 【 - block the I2C read and write EEPROM
- What is machine learning?Explain machine learning concepts in detail
猜你喜欢
"110 Balanced Binary Tree Judgment" in leetCode's 14-day binary tree series
[C Language] Getting Started
Where can machine learning be applied?What is machine learning useful for?
Provincial level of Echart maps, as well as all prefecture-level download and use
Basic understanding of MongoDB (2)
LeetCode刷题第17天之《3 无重复字符的最长子串》
【FPGA】day20-I2C读写EEPROM
Interchangeability Measurements and Techniques - Calculation of Deviations and Tolerances, Drawing of Tolerance Charts, Selection of Fits and Tolerance Classes
What is Machine Reinforcement Learning?What is the principle?
es-head插件插入查询以及条件查询(五)
随机推荐
Mysql中事件和定时任务
UNI-APP_iphone bottom safe area
【FPGA】SDRAM
Pinduoduo store business license related issues
[FPGA] day19- binary to decimal (BCD code)
Introduction to c # a week of high-level programming c # - LINQ Day Four
【人话版】WEB3将至之“权益的游戏”
AVH 动手实践 (二) | 在 Arm 虚拟硬件上部署 PP-OCR 模型
洛谷P4324 扭动的回文串
What is third-party payment?
Leetcode 450. 删除二叉搜索树中的节点
What is ensemble learning in machine learning?
Binary tree related code questions [more complete] C language
The custom of the C language types -- -- -- -- -- - structure
es-head插件插入查询以及条件查询(五)
LeetCode刷题第10天字符串系列之《125回文串验证》
Callable实现多线程
堆排序 和冒泡排序
typedef defines the structure array type
Clang Code Model: Error: The clangbackend executable “X:/clangbackend.exe“ could not be started