Skip to content

Commit

Permalink
Fix NumberOfExperimentsCondition (#470)
Browse files Browse the repository at this point in the history
* debug NumberOfExperimentsCondition

* Update test_conditions.py

* Update test_stepwise.py
  • Loading branch information
chrihaas authored Dec 3, 2024
1 parent 5e46d94 commit 2cdeefd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bofire/data_models/strategies/stepwise/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def evaluate(self, domain: Domain, experiments: Optional[pd.DataFrame]) -> bool:
n_experiments = len(
domain.outputs.preprocess_experiments_all_valid_outputs(experiments),
)
return n_experiments <= self.n_experiments
return n_experiments < self.n_experiments


class AlwaysTrueCondition(SingleCondition, EvaluateableCondition):
Expand Down
2 changes: 1 addition & 1 deletion tests/bofire/strategies/stepwise/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def test_RequiredExperimentsCondition():
benchmark = Himmelblau()
experiments = benchmark.f(benchmark.domain.inputs.sample(3), return_complete=True)
experiments = benchmark.f(benchmark.domain.inputs.sample(2), return_complete=True)
condition = data_models.NumberOfExperimentsCondition(n_experiments=3)
assert condition.evaluate(benchmark.domain, experiments=experiments) is True
experiments = benchmark.f(benchmark.domain.inputs.sample(10), return_complete=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/bofire/strategies/stepwise/test_stepwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_StepwiseStrategy_invalid_AlwaysTrue():

@pytest.mark.parametrize(
"n_experiments, expected_strategy",
[(5, strategies.RandomStrategy), (10, strategies.SoboStrategy)],
[(5, strategies.RandomStrategy), (9, strategies.SoboStrategy)],
)
def test_StepWiseStrategy_get_step(n_experiments, expected_strategy):
benchmark = Himmelblau()
Expand Down

0 comments on commit 2cdeefd

Please sign in to comment.