训练多层感知器时,历元和迭代的区别是什么?


当前回答

我认为迭代相当于批SGD中的单批正向+反向。Epoch将遍历整个数据集一次(正如其他人提到的那样)。

其他回答

Epoch和iteration描述的是不同的东西。


时代

epoch描述了算法看到整个数据集的次数。因此,每当算法看到数据集中的所有样本时,就完成了一个epoch。

迭代

迭代描述了一批数据通过算法的次数。在神经网络的例子中,这意味着向前传递和向后传递。因此,每当你通过神经网络传递一批数据时,你就完成了一次迭代。


例子

举个例子可能会更清楚。

假设您有一个包含10个示例(或样本)的数据集。批处理大小为2,并指定算法运行3个epoch。

因此,在每个epoch中,您有5个批次(10/2 = 5)。每个批次都通过算法,因此每个epoch有5个迭代。 因为您已经指定了3个epoch,所以总共有15个迭代(5*3 = 15)用于训练。

一个epoch包含几个迭代。这就是这个时代。让我们把epoch定义为训练神经网络时在数据集上的迭代次数。

时代 对整个数据集进行完整的训练,使得每个 例子已经见过一次了。因此,一个epoch表示N/batch 大小训练迭代,其中N是的总数 的例子。 迭代 在训练过程中对模型权重的一次更新。 迭代包括计算参数的梯度 对于单批数据的损失。

奖金:

批处理 在一次迭代中使用的示例集(即一个梯度) 更新)的模型训练。 请参见批大小。

来源:https://developers.google.com/machine-learning/glossary/

许多神经网络训练算法都涉及到将整个数据集多次呈现给神经网络。通常,整个数据集的单一表示被称为“epoch”。相比之下,一些算法一次只向神经网络提供一个案例的数据。

“迭代”是一个更一般的术语,但既然你和“epoch”一起问了这个词,我假设你的来源是指一个单一案例对神经网络的呈现。

Epoch is 1 complete cycle where the Neural network has seen all the data. One might have said 100,000 images to train the model, however, memory space might not be sufficient to process all the images at once, hence we split training the model on smaller chunks of data called batches. e.g. batch size is 100. We need to cover all the images using multiple batches. So we will need 1000 iterations to cover all the 100,000 images. (100 batch size * 1000 iterations) Once Neural Network looks at the entire data it is called 1 Epoch (Point 1). One might need multiple epochs to train the model. (let us say 10 epochs).