0

我正在尝试使用 keras_tuner 中的 tuner.search() 调整我的 CNN 的超参数,这需要我为我的训练和验证数据提供特征和标签。

tuner.search(x_train, y_train, epochs=10, validation_data=(x_val, y_val))
best_model = tuner.get_best_models()[0]  

这就是我要拆分为特征和标签的内容

train_data = tf.keras.preprocessing.image_dataset_from_directory(
  data_path,
  validation_split=0.3,
  subset="training",
  seed=1,
  image_size=(img_height, img_width),
  batch_size=batch_size)

我已经研究过使用 sklearn 中的 train_test_split 来做到这一点,但我不知道怎么做。任何帮助将不胜感激。

4

0 回答 0