小编bli*_*soo的帖子

Keras Tuner get_best_hyperparameters()

有什么方法可以将最佳超参数作为列表返回,以便我可以在代码的其他部分访问?我不需要整个模型,我只是希望能够提取它找到的最佳超参数的值并在不同的 python 文件中使用它。

tuner = keras_tuner.RandomSearch(
    hypermodel=build_model,
    objective="val_loss",
    max_trials=2,
    executions_per_trial=2,
    overwrite=True,
    directory="my_dir",
    project_name="helloworld",
)
tuner.search_space_summary()
tuner.search(x_train, y_train, epochs=20, validation_data=(x_val, y_val))

best_hp = tuner.get_best_hyperparameters()[0]

model = tuner.hypermodel.build(best_hp)

summary = tuner.results_summary(num_trials=10)
Run Code Online (Sandbox Code Playgroud)

例如,我想检索 best_hp 列表,或 results_summary 返回到我的终端的最佳超参数的摘要。

python-3.x tensorflow keras-tuner

3
推荐指数
1
解决办法
4281
查看次数

标签 统计

keras-tuner ×1

python-3.x ×1

tensorflow ×1