我在为Keras准备RNN的输入数据时遇到了麻烦.
目前,我的培训数据维度是: (6752, 600, 13)
X_train并且Y_train都在这个方面.
我想把这些数据准备好SimpleRNN用于Keras.假设我们正在经历时间步骤,从步骤#0到步骤#599.假设我想使用input_length = 5,这意味着我想使用最近的5个输入.(例如步骤#10,#11,#12,#13,#14 @步骤#14).
我应该如何重塑X_train?
应该是(6752, 5, 600, 13)或应该是(6752, 600, 5, 13)吗?
什么形状应该Y_train在?
它应该是(6752, 600, 13)或(6752, 1, 600, 13)或(6752, 600, 1, 13)?
我一直在研究一个使用时间序列数据与天气数据相结合来估计交通流量的项目。我的时间序列使用了 30 个值的窗口,并且使用了 20 个与天气相关的特征。我已经使用函数式 API 来实现此目的,但我不断收到相同的错误,并且我不知道如何解决它。我查看了其他类似的线程,例如层 conv1d_1 的输入 0 与该层不兼容:预期 ndim=3,发现 ndim=2。收到的完整形状:[无,200],但没有帮助。
这是我的模型,
series_input = Input(shape = (series_input_train.shape[1], ), name = 'series_input')
x = Conv1D(filters=32, kernel_size=5, strides=1, padding="causal", activation="relu")(series_input)
x = LSTM(32, return_sequences = True)(x)
x = LSTM(32, return_sequences = True)(x)
x = Dense(1, activation = 'relu')(x)
series_output = Lambda(lambda w: w * 200)(x)
weather_input = Input(shape = (weather_input_train.shape[1], ), name = 'weather_input')
x = Dense(32, activation = 'relu')(weather_input)
x = Dense(32, activation = 'relu')(x)
weather_output = …Run Code Online (Sandbox Code Playgroud)