本文介绍了Deeplearning4j中的纪元和迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始学习Deeplearning4j,但我不明白纪元和迭代的概念是如何实际实现的。
在在线文档中说:

I recently started learning Deeplearning4j and I fail to understand how the concept of epochs and iterations is actually implemented.In the online documentation it says:

我使用MultipleEpochsIterator进行了训练,但是对于第一次运行,我设置了1个历元,miniBatchSize = 1和1000个样本的数据集,因此我希望训练在1个历元和1000次迭代后完成,但是经过100.000次迭代后

I ran a training using a MultipleEpochsIterator, but for the first run I set 1 epoch, miniBatchSize = 1 and a dataset of 1000 samples, so I expected the training to finish after 1 epoch and 1000 iterations, but after more than 100.000 iterations it was still running.

int nEpochs = 1;
int miniBatchSize = 1;

MyDataSetFetcher fetcher = new MyDataSetFetcher(xDataDir, tDataDir, xSamples, tSamples);
//The same batch size set here was set in the model
BaseDatasetIterator baseIterator = new BaseDatasetIterator(miniBatchSize, sampleSize, fetcher);

MultipleEpochsIterator iterator = new MultipleEpochsIterator(nEpochs, baseIterator);
model.fit(iterator)

然后我做了更多的测试来改变批量大小,但是并没有改变IterationListener打印的日志行的频率。我的意思是我以为,如果将批次大小增加到100,那么使用1000个样本,我将仅更新10次参数,因此仅进行10次迭代,但是日志和时间戳记间隔大致相同。

Then I did more tests changing the batch size, but that didn't change the frequency of the log lines printed by the IterationListener. I mean that I thought that if I increase the batch size to 100 then with 1000 samples I would have just 10 updates of the parameters an therefore just 10 iterations, but the logs and the timestamp intervals are more or less the same.

BTW。有一个类似的问题,但答案实际上并未回答我的问题,我想更好地理解实际详细信息:

BTW. There is a similar question, but the answer does not actually answer my question, I would like to understand better the actual details:Deeplearning4j: Iterations, Epochs, and ScoreIterationListener

推荐答案

这些都不重要1.x(已经在alpha版本中)之后了-我们早就摆脱了迭代。

None of this will matter after 1.x (which is already out in alpha) - we got rid of iterations long ago.

最初,它的意思是快捷语法,因此人们不会编写for循环。

Originally it was meant to be shortcut syntax so folks wouldn't have to write for loops.

现在只关注带有历元的for循环。

Just focus on for loops with epochs now.

这篇关于Deeplearning4j中的纪元和迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 20:01