TensorFlow 中的 step 和 epochs 有什么区别? [英] What is the difference between steps and epochs in TensorFlow?

查看:223
本文介绍了TensorFlow 中的 step 和 epochs 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数模型中,有一个 steps 参数指示运行数据的步数.但我看到在大多数实际使用中,我们还执行了拟合函数 N epochs.

In most of the models, there is a steps parameter indicating the number of steps to run over data. But yet I see in most practical usage, we also execute the fit function N epochs.

1 epoch 跑 1000 步和 10 epoch 跑 100 步有什么区别?在实践中哪个更好?连续纪元之间的任何逻辑变化?数据洗牌?

What is the difference between running 1000 steps with 1 epoch and running 100 steps with 10 epoch? Which one is better in practice? Any logic changes between consecutive epochs? Data shuffling?

推荐答案

一个训练步骤是一个梯度更新.一步处理batch_size示例.

A training step is one gradient update. In one step batch_size examples are processed.

一个 epoch 由一个完整的循环训练数据组成.这通常需要很多步骤.例如,如果您有 2,000 张图像并使用 10 的批量大小,则一个 epoch 包括:

An epoch consists of one full cycle through the training data. This is usually many steps. As an example, if you have 2,000 images and use a batch size of 10 an epoch consists of:

2,000 images / (10 images / step) = 200 steps.

如果您在每个步骤中随机(且独立地)选择您的训练图像,您通常不称其为纪元.[这是我的回答与上一个不同的地方.另见我的评论.]

If you choose your training image randomly (and independently) in each step, you normally do not call it epoch. [This is where my answer differs from the previous one. Also see my comment.]

这篇关于TensorFlow 中的 step 和 epochs 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆