Skip to content

Commit

Permalink
fix setting seed when nr sobol trials is not zero
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbroscheit committed Mar 11, 2020
1 parent abd0056 commit 398b0b6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions kge/job/ax_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def init_search(self):
num_arms=self.num_sobol_trials,
min_arms_observed=ceil(self.num_sobol_trials / 2),
enforce_num_arms=True,
model_kwargs={'seed': 0}
),
GenerationStep(
model=Models.GPEI,
Expand Down Expand Up @@ -77,14 +78,9 @@ def init_search(self):

# Make sure sobol models are resumed correctly
if self.ax_client.generation_strategy._curr.model == Models.SOBOL:
# Fix seed for sobol. We do this by generating the model right away (instead
# of automatically once first trial is generated).
if self.ax_client.generation_strategy._curr.model_kwargs is not None:
kwargs = {}
else:
kwargs = {'seed':0}

self.ax_client.generation_strategy._set_current_model(
experiment=self.ax_client.experiment, data=None, **kwargs
experiment=self.ax_client.experiment, data=None
)

# Regenerate and drop SOBOL arms already generated. Since we fixed the seed,
Expand Down

0 comments on commit 398b0b6

Please sign in to comment.