-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_DyHPO_example.py
26 lines (20 loc) · 1 KB
/
simple_DyHPO_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from benchmark_handler import BenchmarkHandler
from optimizers.dyhpo import DyHPO
from optimizers.dyhpo_utils import AutoRLBench
search_space = "PPO"
benchmark = BenchmarkHandler(environment="Pong-v0",
search_space=search_space,
return_metrics=["eval_avg_returns"],
seed=0)
hporrlbench_data = AutoRLBench(path_to_json_files='',
ss_name=search_space,
env_name='Pong-v0',
seed=0)
dyhpo = DyHPO(search_space_name=search_space, search_space=benchmark.get_search_space(search_space),
obj_function=benchmark.get_metrics, max_budget=99, seed=0,
min_value=hporrlbench_data.min_value, max_value=hporrlbench_data.max_value)
n_iters = 20
print("Running DyHPO")
best_conf, best_score = dyhpo.suggest(n_iterations=n_iters)
print(f"Best configuration found is {best_conf}")
print(f"Best final evaluation return is {best_score}")