Skip to content

Commit e609b3d

Browse files
committed
make tests faster
1 parent 2b23413 commit e609b3d

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

das/training/expdas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def run_cv_exp_das(args) -> None:
195195
"name": args.name,
196196
"portfolio": args.portfolio,
197197
"dims": args.dims,
198-
"total_episodes_per_fold": args.total_episodes,
198+
"n_epochs_per_fold": args.n_epochs,
199199
"n_folds_run": len(fold_summaries),
200200
"overall_mean_best_y": float(np.mean(all_best_y)) if all_best_y else None,
201201
"folds": fold_summaries,

tests/test_baselines.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def get_problem(self, problem_id: str) -> MockProblem:
5656

5757
PROBLEM_IDS = [f"mock_f{i:02d}" for i in range(4)]
5858
N_CHECKPOINTS = 3
59-
FE_MULTIPLIER = 50
59+
FE_MULTIPLIER = (
60+
5 # keep total budget (FE_MULTIPLIER × dim) < 50 to avoid ELA computation
61+
)
6062
N_INDIVIDUALS = 10
6163
PORTFOLIO = ["SPSO", "IPSO"]
6264

@@ -259,11 +261,8 @@ def test_run_single_uses_full_budget(self):
259261
"""The optimizer must receive the full budget (fe_multiplier × dim)."""
260262
opt_class = get_portfolio(["SPSO"])[0]
261263
problem = MockProblem("test_p", dim=2)
262-
# With tiny budget the optimizer can barely initialise
263-
result_small = run_single_algorithm(opt_class, problem, 5, N_INDIVIDUALS)
264-
result_large = run_single_algorithm(
265-
opt_class, problem, FE_MULTIPLIER, N_INDIVIDUALS
266-
)
264+
result_small = run_single_algorithm(opt_class, problem, 2, N_INDIVIDUALS)
265+
result_large = run_single_algorithm(opt_class, problem, 50, N_INDIVIDUALS)
267266
# Larger budget should not produce a worse result
268267
assert result_large <= result_small + 1e-6
269268

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)