训练有素的LSTM模型可以预测真实数据
我正在开发一个LSTM模型来预测库存运动。看来该模型经过了良好的训练,其val_loss和损失低。但是预测真实数据并不能很好地工作。
以下是培训的产出:
Epoch 75: val_loss improved from 0.03284 to 0.03071, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 50s - loss: 0.0379 - accuracy: 0.9485 - val_loss: 0.0307 - val_accuracy: 0.9593 - 50s/epoch - 88ms/step
Epoch 76/100
Epoch 85: val_loss did not improve from 0.04519
580/580 - 47s - loss: 0.0546 - accuracy: 0.9173 - val_loss: 0.0500 - val_accuracy: 0.9284 - 47s/epoch - 82ms/step
Epoch 86/100
Epoch 76: val_loss did not improve from 0.03071
572/572 - 46s - loss: 0.0562 - accuracy: 0.9246 - val_loss: 0.0309 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 77/100
Epoch 86: val_loss improved from 0.04519 to 0.04331, saving model to /data/nn/python/us/stock/idx1/model/dow_260.h5
580/580 - 47s - loss: 0.0563 - accuracy: 0.9192 - val_loss: 0.0433 - val_accuracy: 0.9383 - 47s/epoch - 81ms/step
Epoch 87/100
Epoch 77: val_loss did not improve from 0.03071
572/572 - 46s - loss: 0.0380 - accuracy: 0.9468 - val_loss: 0.0324 - val_accuracy: 0.9558 - 46s/epoch - 81ms/step
Epoch 78/100
Epoch 87: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0566 - accuracy: 0.9194 - val_loss: 0.0440 - val_accuracy: 0.9348 - 47s/epoch - 81ms/step
Epoch 88/100
Epoch 78: val_loss improved from 0.03071 to 0.03060, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0356 - accuracy: 0.9496 - val_loss: 0.0306 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 79/100
Epoch 88: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0536 - accuracy: 0.9221 - val_loss: 0.0446 - val_accuracy: 0.9340 - 47s/epoch - 81ms/step
Epoch 89/100
Epoch 79: val_loss did not improve from 0.03060
572/572 - 46s - loss: 0.0379 - accuracy: 0.9456 - val_loss: 0.0395 - val_accuracy: 0.9501 - 46s/epoch - 81ms/step
Epoch 80/100
Epoch 89: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0528 - accuracy: 0.9264 - val_loss: 0.0444 - val_accuracy: 0.9391 - 47s/epoch - 81ms/step
Epoch 90/100
Epoch 80: val_loss improved from 0.03060 to 0.03018, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0358 - accuracy: 0.9504 - val_loss: 0.0302 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 81/100
Epoch 90: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0732 - accuracy: 0.8934 - val_loss: 0.0714 - val_accuracy: 0.9007 - 47s/epoch - 81ms/step
Epoch 91/100
Epoch 81: val_loss improved from 0.03018 to 0.03003, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0347 - accuracy: 0.9515 - val_loss: 0.0300 - val_accuracy: 0.9584 - 46s/epoch - 80ms/step
我有10,000多个培训场合涵盖了过去五年的美国股票市场。我还有3000个用于验证和3000次测试。 VAL_LOSS随着时间的流逝而降低,准确性同时提高。但是当我进行测试时,准确性实际上低于50%。
有人有相同的经验并可以分享一些见解吗?
谢谢。
I am developing a LSTM model to predict stock movement. It seems that the model is well trained, with low val_loss and loss. But it doesn't work well to predict real data.
The following is the output of the training:
Epoch 75: val_loss improved from 0.03284 to 0.03071, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 50s - loss: 0.0379 - accuracy: 0.9485 - val_loss: 0.0307 - val_accuracy: 0.9593 - 50s/epoch - 88ms/step
Epoch 76/100
Epoch 85: val_loss did not improve from 0.04519
580/580 - 47s - loss: 0.0546 - accuracy: 0.9173 - val_loss: 0.0500 - val_accuracy: 0.9284 - 47s/epoch - 82ms/step
Epoch 86/100
Epoch 76: val_loss did not improve from 0.03071
572/572 - 46s - loss: 0.0562 - accuracy: 0.9246 - val_loss: 0.0309 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 77/100
Epoch 86: val_loss improved from 0.04519 to 0.04331, saving model to /data/nn/python/us/stock/idx1/model/dow_260.h5
580/580 - 47s - loss: 0.0563 - accuracy: 0.9192 - val_loss: 0.0433 - val_accuracy: 0.9383 - 47s/epoch - 81ms/step
Epoch 87/100
Epoch 77: val_loss did not improve from 0.03071
572/572 - 46s - loss: 0.0380 - accuracy: 0.9468 - val_loss: 0.0324 - val_accuracy: 0.9558 - 46s/epoch - 81ms/step
Epoch 78/100
Epoch 87: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0566 - accuracy: 0.9194 - val_loss: 0.0440 - val_accuracy: 0.9348 - 47s/epoch - 81ms/step
Epoch 88/100
Epoch 78: val_loss improved from 0.03071 to 0.03060, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0356 - accuracy: 0.9496 - val_loss: 0.0306 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 79/100
Epoch 88: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0536 - accuracy: 0.9221 - val_loss: 0.0446 - val_accuracy: 0.9340 - 47s/epoch - 81ms/step
Epoch 89/100
Epoch 79: val_loss did not improve from 0.03060
572/572 - 46s - loss: 0.0379 - accuracy: 0.9456 - val_loss: 0.0395 - val_accuracy: 0.9501 - 46s/epoch - 81ms/step
Epoch 80/100
Epoch 89: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0528 - accuracy: 0.9264 - val_loss: 0.0444 - val_accuracy: 0.9391 - 47s/epoch - 81ms/step
Epoch 90/100
Epoch 80: val_loss improved from 0.03060 to 0.03018, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0358 - accuracy: 0.9504 - val_loss: 0.0302 - val_accuracy: 0.9580 - 46s/epoch - 81ms/step
Epoch 81/100
Epoch 90: val_loss did not improve from 0.04331
580/580 - 47s - loss: 0.0732 - accuracy: 0.8934 - val_loss: 0.0714 - val_accuracy: 0.9007 - 47s/epoch - 81ms/step
Epoch 91/100
Epoch 81: val_loss improved from 0.03018 to 0.03003, saving model to /data/nn/python/us/stock/idx1/model/dow_257.h5
572/572 - 46s - loss: 0.0347 - accuracy: 0.9515 - val_loss: 0.0300 - val_accuracy: 0.9584 - 46s/epoch - 80ms/step
I have over 10,000 instances in training set covering the past five year period of US stock market. I have another 3000 for validation and 3000 for testing. The val_loss decreases over time and accuracy increases at the same time. But when I did testing, the accuracy is actually below 50%.
Does anyone have the same experience and can share some insights?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论