Skip to content

Commit 7ab1be5

Browse files
committed
Add support for x0 with skopt search strategy
1 parent c05ed93 commit 7ab1be5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

kernel_tuner/strategies/skopt.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def tune(searchspace: Searchspace, runner, tuning_options):
3232
max_fevals = min(tuning_options.get("max_fevals", np.inf), searchspace.size)
3333

3434
# Const function
35-
cost_func = CostFunc(searchspace, tuning_options, runner)
3635
opt_config, opt_result = None, None
3736

3837
# The dimensions. Parameters with one value become categorical
@@ -76,6 +75,14 @@ def tune(searchspace: Searchspace, runner, tuning_options):
7675
if tuning_options.verbose:
7776
print(f"Asked optimizer for {num_initial} points: {batch}")
7877

78+
# Create cost function
79+
cost_func = CostFunc(searchspace, tuning_options, runner)
80+
x0 = costfunc.get_start_pos()
81+
82+
# Add x0 if the user has requested it
83+
if x0 is not None:
84+
batch.insert(0, x0)
85+
7986
try:
8087
while eval_count < max_fevals:
8188
if not batch:

0 commit comments

Comments
 (0)