【问题标题】:Pytorch RNN prediction results do not match training resultsPytorch RNN 预测结果与训练结果不匹配
【发布时间】:2019-07-30 16:28:42
【问题描述】:

RNN 代码在训练期间产生了良好的正弦近似值,但在基于之前的预测(以 20 个原始值开始)预测正弦值时,它无法逼近正弦值。 (查看图片https://imgur.com/a/GCQ6QgG

因此,要么预测代码中存在错误,要么模型通常无法处理重新输入的预测。但我认为这更像是我的代码中的一个错误:)

代码: https://gist.github.com/saschalippert/36b72313afff86e00f3e10254fb4ff25

日志:

RNN(
  (rnn): RNN(1, 64, batch_first=True)
  (fc): Linear(in_features=64, out_features=1, bias=True)
)
Training for 10 epoch(s)...
Epoch:    1/10    Loss: 0.05084234103560448
Epoch:    2/10    Loss: 0.006296889390796423
Epoch:    3/10    Loss: 0.005784639157354832
Epoch:    4/10    Loss: 0.0037908838130533695
Epoch:    5/10    Loss: 0.0030788308940827847
Epoch:    6/10    Loss: 0.0027744979597628117
Epoch:    7/10    Loss: 0.0027218328323215246
Epoch:    8/10    Loss: 0.00589225348085165
Epoch:    9/10    Loss: 0.0020567490719258785
Epoch:   10/10    Loss: 0.000807589094620198

【问题讨论】:

    标签: python machine-learning neural-network pytorch


    【解决方案1】:

    进一步的测试表明,向网络提供预测值(与目标值略有偏差)会导致未来值失控。使用更复杂的模型并训练更多剧集似乎可以解决问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-13
      • 1970-01-01
      • 2020-02-20
      • 2023-04-08
      相关资源
      最近更新 更多