From 4696ef2751d26155146e4946662cef5ae86eff87 Mon Sep 17 00:00:00 2001 From: Xbc-gressor <2765024335@qq.com> Date: Sun, 8 Sep 2024 23:34:48 +0800 Subject: [PATCH] fix early stop test bug --- test/core/test_async_batch_advisor.py | 12 ------------ test/core/test_mf_batch_advisor.py | 2 +- test/core/test_sync_batch_advisor.py | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/test/core/test_async_batch_advisor.py b/test/core/test_async_batch_advisor.py index dd524784..1bcb8264 100644 --- a/test/core/test_async_batch_advisor.py +++ b/test/core/test_async_batch_advisor.py @@ -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() diff --git a/test/core/test_mf_batch_advisor.py b/test/core/test_mf_batch_advisor.py index 98085fe1..4ddcd2ae 100644 --- a/test/core/test_mf_batch_advisor.py +++ b/test/core/test_mf_batch_advisor.py @@ -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] diff --git a/test/core/test_sync_batch_advisor.py b/test/core/test_sync_batch_advisor.py index d10a9acf..b52bedbd 100644 --- a/test/core/test_sync_batch_advisor.py +++ b/test/core/test_sync_batch_advisor.py @@ -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()