【发布时间】:2021-05-24 00:00:00
【问题描述】:
我有一个数组用于尝试使用 tf.Keras 进行一些 times series sliding window method for machine learning 预测:
X.shape
(8779, 6, 1)
适应 MLP 模型:
# define model
model = Sequential()
model.add(Dense(100, activation='relu', input_shape=(6,)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')
谁能给我一个关于如何纠正这个模型输入的提示?
input_shape=(6,)
我不知道如何克服这个错误:
ValueError: Input 0 of layer sequential is incompatible with the layer: expected axis -1 of input shape to have value 6 but received input with shape (None, 6, 1)
【问题讨论】:
-
我认为你需要设置
input_shape=6而不是input=(6,) -
更改为
input_shape=(6,1) -
@Andrey 谢谢你的工作
标签: python tensorflow machine-learning keras time-series