LSTM神经网络的错误预测 [英] Wrong predictions with LSTM Neural Network

查看:152
本文介绍了LSTM神经网络的错误预测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是LSTM的新手,我正在尝试训练一个模型,以在给定一年数据的情况下预测IP的流量.数据集由Kaggle提供, https://www.kaggle.com/crawford/computer-网络流量.

I am new with LSTM and I Am trying to train a model to predict the traffic flow of an IP given a year of data. The dataset is provided by Kaggle https://www.kaggle.com/crawford/computer-network-traffic.

这是网络建模的方式

model = Sequential()
model.add(LSTM(128,input_shape=(trainX.shape[1], trainX.shape[2]),
               activation='relu',return_sequences=True))
model.add(LSTM(32, return_sequences=True))
model.add(LSTM(10))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, epochs=10, batch_size=64, verbose=2)

您可以在我的内核中找到所有详细信息 https://www .kaggle.com/asindico/computer-network-traffic-eda/

You can find all the details in my kernel https://www.kaggle.com/asindico/computer-network-traffic-eda/

这是我在10个纪元后得到的

this is what I get after 10 epochs

以蓝色表示实际值,以红色表示预测.

in blu the actual values, in red the predictions.

推荐答案

不幸的是,没有针对该问题的通用解决方案,但是很明显,您的模型不足以容纳数据.

unfortunately, there is no universal solution for that issue, but it's clear your model underfitts the data.

我有什么建议?

  • 减少模型中的隐藏层数

  • Reduce the number of hidden layers in your model,

增加时期数

将优化器功能更改/尝试为"sgd"或"RMSprop",

change/try the optimizer function to "sgd" or "RMSprop",

增加批次大小,

并添加正则化和辍学.

就像我说的那样,没有通用的解决方案,因此,从上面尝试一下,可能会对您有所帮助.

As I said, there is no universal solution, so, try something from above and it might help you.

此外,检查输出层的激活功能. +如建议的那样对输入数据进行归一化.

Also, check the activation function for the output layer. + as was suggested normalize the input data.

这篇关于LSTM神经网络的错误预测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆