训练神经网络时的 Epoch 与迭代

问题描述:

在训练多层感知器时,epochiteration 有什么区别?

What is the difference between epoch and iteration when training a multi-layer perceptron?

在神经网络术语中:

  • one epoch = 所有训练样本的一次前向传递和一次后向传递
  • 批量大小 = 一次向前/向后传递中的训练示例数量.批量越大,您需要的内存空间就越多.
  • 迭代次数 = 传递次数,每次传递使用 [批量大小] 示例数量.需要明确的是,一次传球 = 一次向前传球 + 一次向后传球(我们不将向前传球和向后传球算作两次不同的传球).
  • one epoch = one forward pass and one backward pass of all the training examples
  • batch size = the number of training examples in one forward/backward pass. The higher the batch size, the more memory space you'll need.
  • number of iterations = number of passes, each pass using [batch size] number of examples. To be clear, one pass = one forward pass + one backward pass (we do not count the forward pass and backward pass as two different passes).

示例:如果您有 1000 个训练示例,并且您的批次大小为 500,则需要 2 次迭代才能完成 1 个 epoch.

Example: if you have 1000 training examples, and your batch size is 500, then it will take 2 iterations to complete 1 epoch.

仅供参考:权衡批量大小与训练神经网络的迭代次数

术语批处理"含糊不清:有些人用它来指定整个训练集,而有些人用它来指代一次向前/向后传递中的训练示例的数量(就像我在这个答案中所做的那样).为了避免这种歧义并明确批对应于一次向前/向后传递中的训练示例的数量,可以使用术语小批量.

The term "batch" is ambiguous: some people use it to designate the entire training set, and some people use it to refer to the number of training examples in one forward/backward pass (as I did in this answer). To avoid that ambiguity and make clear that batch corresponds to the number of training examples in one forward/backward pass, one can use the term mini-batch.