Is there any way to have the best hyperparameters get returned as a list that I can access in other parts of my code? I don't want the entire model, I just want to be able to extract the values of the optimal hyperparameters it finds and use it in a different python file.
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)
For example, I would like to retrieve the list of best_hp, or the summary of the best hyperparameters that results_summary returns to my terminal.