Skip to content

Commit

Permalink
fix early stop test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Xbc-gressor committed Sep 8, 2024
1 parent 2a6b14c commit 4696ef2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions test/core/test_async_batch_advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,3 @@ def test_async_batch_advisor_initialization(configspace_tiny, history_single_obs
advisor.update_observation(observation)
assert len(advisor.history) == 1


def test_async_batch_advisor_early_stop(configspace_tiny):
config_space = configspace_tiny
advisor = AsyncBatchAdvisor(config_space, early_stop=True, early_stop_kwargs={'min_iter': 3, 'min_improvement_percentage': 100})

for i in range(3):
suggestion = advisor.get_suggestion()
observation = Observation(suggestion, [10-i], trial_state=SUCCESS, elapsed_time=2.0, extra_info={})
advisor.update_observation(observation)

with pytest.raises(EarlyStopException):
advisor.get_suggestion()
2 changes: 1 addition & 1 deletion test/core/test_mf_batch_advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_mf_batch_advisor(configspace_tiny, history_single_obs):

def test_mf_advisor_early_stop(configspace_tiny):
config_space = configspace_tiny
advisor = MFBatchAdvisor(config_space, early_stop=True, early_stop_kwargs={'min_iter': 3, 'min_improvement_percentage': 100})
advisor = MFBatchAdvisor(config_space, early_stop=True, early_stop_kwargs={'min_iter': 3, 'min_improvement_percentage': 1e8})

for i in range(3):
suggestion = advisor.get_suggestions(1)[0]
Expand Down
2 changes: 1 addition & 1 deletion test/core/test_sync_batch_advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_sync_batch_advisora(configspace_tiny, history_single_obs):

def test_sync_batch_advisor_early_stop(configspace_tiny):
config_space = configspace_tiny
advisor = SyncBatchAdvisor(config_space, early_stop=True, early_stop_kwargs={'min_iter': 3, 'min_improvement_percentage': 100})
advisor = SyncBatchAdvisor(config_space, early_stop=True, early_stop_kwargs={'min_iter': 3, 'min_improvement_percentage': 1e8})

for i in range(3):
suggestion = advisor.get_suggestion()
Expand Down

0 comments on commit 4696ef2

Please sign in to comment.