Skip to content

Commit

Permalink
fix: don't use unnormalize due to unexpected behaviour with constant …
Browse files Browse the repository at this point in the history
…bounds
  • Loading branch information
CompRhys committed Nov 25, 2024
1 parent a022462 commit e75239d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion botorch/optim/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def gen_batch_initial_conditions(
X_rnd_nlzd = torch.rand(
n, q, bounds_cpu.shape[-1], dtype=bounds.dtype
)
X_rnd = unnormalize(X_rnd_nlzd, bounds_cpu)
X_rnd = X_rnd_nlzd * (bounds_cpu[1] - bounds_cpu[0]) + bounds_cpu[0]
else:
X_rnd = sample_q_batches_from_polytope(
n=n,
Expand Down
2 changes: 1 addition & 1 deletion botorch/utils/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def draw_sobol_samples(
samples_raw = samples_raw.view(*batch_shape, n, q, d).to(device=bounds.device)
if batch_shape != torch.Size():
samples_raw = samples_raw.permute(-3, *range(len(batch_shape)), -2, -1)
return unnormalize(samples_raw, bounds)
return bounds[0] + (bounds[1] - bounds[0]) * samples_raw


def draw_sobol_normal_samples(
Expand Down

0 comments on commit e75239d

Please sign in to comment.