Skip to content

Commit 8e9a780

Browse files
authored
Merge pull request #336 from KernelTuner/fix_issue_335
Fix issue 335 `ValueError: (...) is not in list` during Bayesian optimization
2 parents 5a48c0b + b791425 commit 8e9a780

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

kernel_tuner/strategies/bayes_opt.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,11 @@ def draw_latin_hypercube_samples(self, num_samples: int) -> list:
501501
normalized_param_config = self.normalize_param_config(param_config)
502502
try:
503503
index = self.find_param_config_index(normalized_param_config)
504-
indices.append(index)
505-
normalized_param_configs.append(normalized_param_config)
504+
505+
# returned indices must not contain duplicates
506+
if index not in indices:
507+
indices.append(index)
508+
normalized_param_configs.append(normalized_param_config)
506509
except ValueError:
507510
"""With search space restrictions, the search space may not be a cartesian product of parameter values.
508511
It is thus possible for LHS to generate a parameter combination that is not in the actual searchspace.

0 commit comments

Comments
 (0)