简体   繁体   English

4000 个 Epoch 后损失增加

[英]Loss increases after 4000 Epochs

I am trying to train a RNN Network for stock price prediction for my Master Thesis.我正在尝试为我的硕士论文训练一个用于股票价格预测的 RNN 网络。 I have additional input values (6), not just the stock prices by itself.我有额外的输入值 (6),而不仅仅是股票价格本身。

Using an LSTM Network with the "optimal" structure based on Hyperparameter Tuning with Keras Tuner, i observed a significant increase in the losses for training and validation in my case after 4000 Epochs.使用基于带 Keras Tuner 的超参数调优的“最佳”结构的 LSTM 网络,我观察到在 4000 次迭代后,在我的案例中训练和验证的损失显着增加。

My dataset consists of about 12 000 datapoints and i use the Adam optimizer with mean_absolute_error loss function我的数据集包含大约 12 000 个数据点,我使用Adam优化器和mean_absolute_error损失函数

The Network is quite deep with the following layers:网络非常深,有以下几层:

LSTM (24 unit) LSTM(24 单元)
Dropout退出
LSTM (366 unit) LSTM(366 单元)
Dropout退出
LSTM (150 unit) LSTM(150 单位)
Dropout退出
Dense (1 unit)密集(1个单位)

I attached a graph of the loss (sorry for the german)我附上了一张损失图(对不起德国人)

I would really like to understand what leads to this (for me) unexpected behaviour.我真的很想了解导致这种(对我而言)意外行为的原因。

亏损发展

Your learning rate (often called alpha) is probably too large.您的学习率(通常称为 alpha)可能太大了。 Try to factor the learning rate down and try again.尝试降低学习率,然后再试一次。

it may be because of overfitting to the training data.这可能是因为对训练数据过度拟合。 if your setup for training uses a validation set for computing the accuracy, after a number of epochs the model becomes overfit on the training data which means it does very well on the training data but it won't generalize well on verification and test data.如果您的训练设置使用验证集来计算准确度,则在多次迭代后,模型会在训练数据上过度拟合,这意味着它在训练数据上表现非常好,但在验证和测试数据上不能很好地泛化。 to solve this issue you could use regularization techniques or the easier approach is to just stop training when the accuracy starts to drop.要解决这个问题,您可以使用正则化技术,或者更简单的方法是在准确度开始下降时停止训练。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM