与简单均值相比,神经网络时间序列预测模型表现不佳

问题描述 投票:0回答:0

我正在做一个时间序列预测项目,使用神经网络提前 2 步预测值。我当前的模型比输入数据中每一行的简单平均值更差。我想深入了解为什么会发生这种情况以及如何改进我的模型。

这是我目前的神经网络架构:

input_layer = Input(shape=(5, 1))

x = Bidirectional(LSTM(128, return_sequences=True))(input_layer)
x = Bidirectional(LSTM(64, return_sequences=False))(x)
x = Dense(64, activation="relu")(x)
x = Dropout(0.5)(x)  # Adding dropout for regularization
x = Dense(32, activation="relu")(x)
x = Dropout(0.5)(x)  # Adding dropout for regularization
output_layer = Dense(2, activation="relu")(x)  # Removing ReLU activation in the output layer

model = Model(inputs=input_layer, outputs=output_layer)
model.compile(optimizer="rmsprop", loss="mean_squared_error")

这里是总结:

model.summary()
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 input_6 (InputLayer)        [(None, 5, 1)]            0         
                                                                 
 bidirectional_4 (Bidirectio  (None, 5, 256)           133120    
 nal)                                                            
                                                                 
 bidirectional_5 (Bidirectio  (None, 128)              164352    
 nal)                                                            
                                                                 
 dense_11 (Dense)            (None, 64)                8256      
                                                                 
 dropout_2 (Dropout)         (None, 64)                0         
                                                                 
 dense_12 (Dense)            (None, 32)                2080      
                                                                 
 dropout_3 (Dropout)         (None, 32)                0         
                                                                 
 dense_13 (Dense)            (None, 2)                 66        
                                                                 
=================================================================
Total params: 307,874
Trainable params: 307,874
Non-trainable params: 0
_________________________________________________________________

我用以下输入数据训练模型:

X_train.shape
(271743, 5, 1)
y_train.shape
(271743, 2)

我的模型预测和测试数据之间的 RMSE 是:

RMSE: [0.00366597 0.00350496]
Overall RMSE: 0.0035854615665842733

然而,当我比较输入数据 (X_train) 和测试数据中每一行的简单平均值之间的 RMSE 时,误差要低得多:

RMSE: [0.00024059 0.00028185]
Overall RMSE: 0.00026122037739273707

我的模型已经训练了 100 个 epoch,我已经尝试从输出层移除激活函数。然而,这导致更糟糕的结果,所有预测都变成负数,即使输入数据在 0 和 1 之间缩放。

考虑到模型的复杂性和参数的数量,我预计性能会比简单均值更好。即使在每个输入上运行线性模型也应该产生更好的结果。有趣的是,即使我尝试过,我似乎也不会过度拟合模型。

为什么我的神经网络与简单均值相比表现不佳,我可以采取哪些措施来提高其性能?

python keras time-series lstm prediction
© www.soinside.com 2019 - 2025. All rights reserved.