Skip to content

Commit 768d189

Browse files
bugfix in start position generation and greedy mls
1 parent 61536be commit 768d189

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

kernel_tuner/strategies/common.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,8 @@ def get_bounds_x0_eps(self):
153153
else:
154154
bounds = self.get_bounds()
155155
if not x0:
156-
x0 = [(min_v + max_v) / 2.0 for (min_v, max_v) in bounds]
157-
eps = 1e9
158-
for v_list in values:
159-
if len(v_list) > 1:
160-
vals = np.sort(v_list)
161-
eps = min(eps, np.amin(np.gradient(vals)))
156+
x0 = list(self.searchspace.get_random_sample(1)[0])
157+
eps = 1
162158

163159
self.tuning_options["eps"] = eps
164160
logging.debug('get_bounds_x0_eps called')

kernel_tuner/strategies/greedy_mls.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,19 @@ def tune(searchspace: Searchspace, runner, tuning_options):
2424

2525
fevals = 0
2626

27-
first_candidate = cost_func.get_start_pos()
27+
candidate = cost_func.get_start_pos()
2828

2929
#while searching
3030
while fevals < max_fevals:
31-
if first_candidate:
32-
candidate = first_candidate
33-
first_candidate = None
34-
else:
35-
candidate = searchspace.get_random_sample(1)[0]
36-
3731
try:
3832
base_hillclimb(candidate, neighbor, max_fevals, searchspace, tuning_options, cost_func, restart=restart, randomize=randomize, order=order)
3933
except util.StopCriterionReached as e:
4034
if tuning_options.verbose:
4135
print(e)
4236
return cost_func.results
4337

38+
candidate = searchspace.get_random_sample(1)[0]
39+
4440
fevals = len(tuning_options.unique_results)
4541

4642
return cost_func.results

0 commit comments

Comments
 (0)