我正在研究深度马尔可夫模型的教程,他们正在尝试学习复音数据集。教程链接为:
https://pyro.ai/examples/dmm.html
此模型使用神经网络对过渡和发射进行参数化,对于变分推断部分,他们使用RNN将可观察到的“ x”映射到潜在空间。并且为了确保他们的模型正在学习某些东西,他们尝试最大化ELBO或最小化负面ELBO。他们将负ELBO称为NLL。到目前为止,我了解他们在做什么。但是,下一步使我感到困惑。一旦获得了NLL,就将其除以序列长度之和。
times = [time.time()]
for epoch in range(args.num_epochs):
# accumulator for our estimate of the negative log likelihood
# (or rather -elbo) for this epoch
epoch_nll = 0.0
# prepare mini-batch subsampling indices for this epoch
shuffled_indices = np.arange(N_train_data)
np.random.shuffle(shuffled_indices)
# process each mini-batch; this is where we take gradient steps
for which_mini_batch in range(N_mini_batches):
epoch_nll += process_minibatch(epoch, which_mini_batch, shuffled_indices)
# report training diagnostics
times.append(time.time())
epoch_time = times[-1] - times[-2]
log("[training epoch %04d] %.4f \t\t\t\t(dt = %.3f sec)" %
(epoch, epoch_nll / N_train_time_slices, epoch_time))
而且我不太明白他们为什么这样做。可以解释一下吗?他们在这里平均吗?见识将不胜感激。
在本教程中,他们通过优化过程试图减少损失,并最终希望将其与本教程中的参考文献[1]进行比较。
“最后,我们报告一些诊断信息。请注意,我们通过训练集中的时间片总数对损失进行了归一化(这使我们可以与参考文献[1]进行比较)。”
这是您提供的教程中的。
基本上为所有迷你批次计算损失,并且它们正在对其进行归一化,以使最终损失将是它们最初采用的整个训练数据序列长度上的损失。
并且当我们运行代码时,在从日志记录生成的诊断报告中的每个时期之后,我们都可能会整体损失。