python - TensorFlow Estimators 中的 'batches' 和 'steps' 是什么?它们与 epoch 有何不同?

标签 python machine-learning tensorflow neural-network training-data

我正在尝试使用 TensorFlow 的估算器。在documentation以下代码用于训练和评估网络。

# Fit
nn.fit(x=training_set.data, y=training_set.target, steps=5000)

# Score accuracy
ev = nn.evaluate(x=test_set.data, y=test_set.target, steps=1)
loss_score = ev["loss"]
print("Loss: %s" % loss_score)

整个训练集都传入了,但是我们有steps=5000。这是否意味着只考虑集合中的前 5000 个示例?

在此上下文中,batch_size 参数是什么意思,它如何与steps 交互?

谢谢!

最佳答案

batch_size 是一次处理的示例数。 TF 通过一次前向传播(并行)插入所有这些,然后在同一组上进行反向传播。这是一个迭代,或步骤

steps 参数告诉 TF 运行 5000 次这样的迭代来训练模型。

一个 epoch 对训练集中的每个示例只处理一次。例如,如果您有 100 万个样本,批量大小为 200,那么一个时期需要 5000 步:200 * 5.000 = 1.000.000

这是否澄清了术语?

关于python - TensorFlow Estimators 中的 'batches' 和 'steps' 是什么?它们与 epoch 有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42124395/

相关文章:

python - com_error 工作簿.Add()

python - 在 matplotlib 中绘制列表/数组的散点图

machine-learning - LSA - 特征选择

machine-learning - 在这种情况下,从自然语言输入中提取意图的正确方法是什么?

python - 在 Keras 中,训练有状态 LSTM 模型后,是否必须在预测值时重新训练模型?

tensorflow - 将 MetaGraphDef 转移到 GraphDef 的简单方法?

python - 导入错误 - 在没有已知父包的情况下尝试相对导入

r - R 中的神经网络预测(nnet 包)

python - 谷歌云 ML 引擎中的 Tensorflow 新操作

python - 无法理解 numpy argpartition 输出