keras - Batch training in Keras LSTM
问题描述
If I use a batch_size
of 32 in an LSTM
made with Keras
, is the loss function applied to each sequence and then averaged, or is it applied directly to all sequences without taking each sequence into account?
Thanks in advance.
解决方案
Since a batch_size of one would imply updating the weights after a sequence, a batch size of 32 would mean updating the weights after those 32 sequences.
So the weights are updated only after this chunk of 32 sequences, with the loss as average on all of those, since otherwise if the loss would be updated to each one in itself, it would actually represent the plain SGD with batch_size = 1.
推荐阅读
- java - Vertical RangeSlider(双头搜索栏)(双搜索栏)
- oracle - 仅使用 pl/sql 脚本从文本文件中读取数据并在存储过程输入参数中传递该数据
- mongodb - Mongodb查询获取第n个文档
- mysql - 如何从 SQL 中的另一行获取最小值?
- python - 对熊猫数据框中的文本进行切片
- hashicorp-vault - Hashcrop Vault 备份/使用 SQL 备份恢复
- jquery - 使用Get函数时Jquery忽略错误
- ios - 如何使用 Swift 在 iOS 中创建空间音频?
- reactjs - 如何禁用/灰显 setSubmittedNominees 状态下可用的两条记录的下拉选择复选框?
- airflow - Microservices orchestration choices