1

我想预测股价,我已经定义了我的模型:

model = keras.models.Sequential([
    keras.layers.Dense(10, activation='relu',
                       input_shape=(window, train.shape[1],)),
    keras.layers.Dense(5, activation='relu'),
    keras.layers.Dense(1)])
model.compile(loss='mse',
              optimizer=keras.optimizers.Adam(learning_rate=0.0001, beta_1=0.9,
                                              beta_2=0.999, amsgrad=False))
history = model.fit(train_dataset, train_labels, epochs=150)

我收到此错误:

Error when checking target: expected dense_9 to have 3 dimensions, but got array with shape (2110, 1)

注意:我的输入是 (2110, 22, 16) 但我的输出是 (2110,1)。2110 是示例数。

我需要帮助来解决这个问题。

4

0 回答 0