简体   繁体   English

tensorflow-keras 如何计算每个 epoch 的训练成本?

[英]How does tensorflow-keras calculate the cost during training in each epoch?

When training a model with tensorflow-keras using the fit function, I get the cost value in each epoch.在使用拟合function 训练带有 tensorflow-keras 的 model 时,我得到了每个时期的成本值。

Let's say the training set contains 100 observations and the batch size is 20, therefore, the model's weights are updated 5 times in each epoch.假设训练集包含 100 个观察值,批量大小为 20,因此,模型的权重在每个 epoch 中更新 5 次。 When the epoch is finished, it prints the cost value of that epoch.当 epoch 结束时,它会打印该 epoch 的成本值。 My question is the following: Is the cost value the average of 5 batches cost, or is it the cost value of the last batch?我的问题是:成本值是 5 批成本的平均值,还是最后一批的成本值?

I believe you can read more on this topic on this Github issue .我相信您可以在此 Github 问题上阅读有关此主题的更多信息。 Insofar as I read it, it is the running average over the 5 batches.就我阅读而言,它是 5 个批次的运行平均值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM