【问题标题】:Error in LSTM model: ValueError: Failed to find data adapter that can handle inputLSTM 模型中的错误:ValueError:无法找到可以处理输入的数据适配器
【发布时间】:2021-05-24 14:05:14
【问题描述】:

ValueError: 未能找到可以处理输入的数据适配器:,

这是错误。

我的编码如下:

early_stopping = tf.keras.callbacks.EarlyStopping(monitor='val_loss', 
                                                  patience=2, mode='min')

model.compile(loss=tf.losses.MeanSquaredError(),
             optimizer=tf.optimizers.Adam(),
             metrics=[tf.metrics.MeanAbsoluteError()])

history = model.fit_generator(train_generator, epochs=50,
                             validation_data=test_generator,
                             shuffle=False,
                             callbacks=[early_stopping])

我认为这是关于我的数据(train_generator):

win_length = 1
batch_size = 12
num_features = 4
train_generator = TimeseriesGenerator(x_train, y_train, length=win_length, sampling_rate=1, batch_size=batch_size)
test_generator = TimeseriesGenerator(x_test, y_test, length=win_length, sampling_rate=1, batch_size=batch_size

我的 train_generator 数据如下所示。

【问题讨论】:

    标签: python tensorflow keras lstm


    【解决方案1】:

    尝试安装 tf 2.4.0 和 keras 2.4.3 版本

    !pip install tensorflow==2.4.0
    !pip install keras==2.4.3
    

    【讨论】:

      猜你喜欢
      • 2020-01-12
      • 1970-01-01
      • 2021-10-19
      • 2020-02-13
      • 1970-01-01
      • 1970-01-01
      • 2020-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多