Skip to content

Commit c39ac5a

Browse files
committed
Adjusted hyper.py for paper
1 parent 0ba00a0 commit c39ac5a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

kernel_tuner/hyper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def tune_hyper_params(target_strategy: str, hyper_params: dict, *args, **kwargs)
6161
# pass a temporary cache file to avoid duplicate execution
6262
if 'cache' not in kwargs:
6363
cachefile = get_random_unique_filename('temp_', '.json')
64-
cachefile = Path("hyperparamtuning_milo_bruteforce_dual_annealing.json")
64+
cachefile = Path(f"hyperparamtuning_paper_bruteforce_{target_strategy}.json")
6565
kwargs['cache'] = str(cachefile)
6666

6767
def put_if_not_present(target_dict, key, value):
@@ -88,14 +88,14 @@ def put_if_not_present(target_dict, key, value):
8888
return list(result_unique.values()), env
8989

9090
if __name__ == "__main__": # TODO remove in production
91-
# hyperparams = {
92-
# 'popsize': [10, 20, 30],
93-
# 'maxiter': [50, 100, 150],
94-
# 'w': [0.25, 0.5, 0.75],
95-
# 'c1': [1.0, 2.0, 3.0],
96-
# 'c2': [0.5, 1.0, 1.5]
97-
# }
98-
# result, env = tune_hyper_params('pso', hyperparams)
91+
hyperparams = {
92+
'popsize': [10, 20, 30],
93+
'maxiter': [50, 100, 150],
94+
'w': [0.25, 0.5, 0.75],
95+
'c1': [1.0, 2.0, 3.0],
96+
'c2': [0.5, 1.0, 1.5]
97+
}
98+
result, env = tune_hyper_params('pso', hyperparams)
9999

100100
# hyperparams = {
101101
# 'neighbor': ['Hamming', 'adjacent'],
@@ -105,10 +105,10 @@ def put_if_not_present(target_dict, key, value):
105105
# }
106106
# result, env = tune_hyper_params('greedy_ils', hyperparams)
107107

108-
hyperparams = {
109-
'method': ['COBYLA', 'L-BFGS-B', 'SLSQP', 'CG', 'Powell', 'Nelder-Mead', 'BFGS', 'trust-constr'],
110-
}
111-
result, env = tune_hyper_params('dual_annealing', hyperparams)
108+
# hyperparams = {
109+
# 'method': ['COBYLA', 'L-BFGS-B', 'SLSQP', 'CG', 'Powell', 'Nelder-Mead', 'BFGS', 'trust-constr'],
110+
# }
111+
# result, env = tune_hyper_params('dual_annealing', hyperparams)
112112

113113
print(result)
114114
print(env['best_config'])

0 commit comments

Comments
 (0)