Skip to content

Commit

Permalink
Merge pull request #4153 from not522/brute-force-test
Browse files Browse the repository at this point in the history
Simplify the test of `BruteForceSampler` for infinite search space
  • Loading branch information
toshihikoyanase committed Nov 10, 2022
2 parents 4e14fca + bff78b8 commit f02f87d
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions tests/samplers_tests/test_brute_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,7 @@ def objective(trial: Trial) -> float:

def test_study_optimize_with_infinite_search_space() -> None:
def objective(trial: Trial) -> float:

a = trial.suggest_int("a", 0, 2)

if a == 0:
b = trial.suggest_float("b", -1.0, 1.0)
return a + b
elif a == 1:
c = trial.suggest_categorical("c", ["x", "y", None])
if c == "x":
return a + 1
else:
return a - 1
else:
return a * 2
return trial.suggest_float("a", 0, 2)

study = optuna.create_study(sampler=samplers.BruteForceSampler())

Expand Down

0 comments on commit f02f87d

Please sign in to comment.