Summary
#386 deliverable 6 is "Tests: each optimizer recovers known parameters on a small FD-validated model; convergence vs a metaheuristic baseline on the same model; a smoke test mirroring examples/becker_d2d_gradient/." The recovery portion is done; the other two parts remain. This issue tracks them.
Done (for reference):
- Parameter-recovery tests through the real bngsim backend —
tests/test_gradient_optimizer.py (rate/IC, estimated-σ, bound-active, multimodal multi-start).
- Offline scipy-oracle step-math parity for the runners —
tests/test_gradient_runner.py.
Part A — convergence vs a metaheuristic baseline
A test that, on the same model, compares a gradient fit (trf / lbfgs) against a metaheuristic baseline (de) and asserts the gradient method does at least as well — the head-to-head #386 asked for, which the truth-recovery tests don't cover.
- The recovery harness already exposes all four algorithms, so this can be built on it directly:
tests/recovery_harness.py _ALGORITHMS = {'de', 'am', 'trf', 'lbfgs'}, with build() / drive() running any of them on one config.
- Design choice to settle (the fuzzy part): what "convergence vs baseline" asserts. Candidates: (a) the gradient fit reaches an objective ≤ the metaheuristic's on the same model/budget; (b) it reaches the known optimum in far fewer objective evaluations (the real selling point of a gradient method — count
success_count / trajectory length); (c) both. Recommend (b)+(a): same small model, both recover the truth, and the gradient fit uses materially fewer evaluations. Keep it deterministic (fixed random_seed) so it isn't flaky.
Part B — becker smoke test
A smoke test mirroring examples/becker_d2d_gradient/ (the D2D EpoR methodological reference: multi-start → TRF) driven through PyBNF's real scheduler (fit_type = trf, now with multi-start), not the standalone BNGsim-direct path the reference notebooks use.
- The reference currently lives only on the unmerged branch
origin/examples/becker-d2d-gradient (an Antimony model BIOMD0000000271.ant, becker_d2d_data.npz, a README, and two notebooks — all standalone, no scheduler).
- A scheduler-driven smoke test needs at least the model + data fixtures on
main (under tests/), exercising the SBML/Antimony gradient path end-to-end (the measurement-model layer + SBML forward sensitivities the assembly already supports). It does not require merging the notebooks.
- Scope is a smoke test: it runs the fit to completion without error and lands at a sane objective — not a tight parameter-recovery assertion on the full EpoR model (which would be slow/flaky). A trimmed model or a short iteration budget is fine.
Optional, separate from the test deliverable
Decide whether to merge the examples/becker-d2d-gradient branch as the on-main standalone reference example (the notebooks + data + README #386 points at). This has independent docs/example value but is not required to close deliverable 6 — the smoke test can ship with just its own fixtures. Track/merge it on its own merits.
Done criteria
References
Summary
#386 deliverable 6 is "Tests: each optimizer recovers known parameters on a small FD-validated model; convergence vs a metaheuristic baseline on the same model; a smoke test mirroring
examples/becker_d2d_gradient/." The recovery portion is done; the other two parts remain. This issue tracks them.Done (for reference):
tests/test_gradient_optimizer.py(rate/IC, estimated-σ, bound-active, multimodal multi-start).tests/test_gradient_runner.py.Part A — convergence vs a metaheuristic baseline
A test that, on the same model, compares a gradient fit (
trf/lbfgs) against a metaheuristic baseline (de) and asserts the gradient method does at least as well — the head-to-head #386 asked for, which the truth-recovery tests don't cover.tests/recovery_harness.py_ALGORITHMS = {'de', 'am', 'trf', 'lbfgs'}, withbuild()/drive()running any of them on one config.success_count/ trajectory length); (c) both. Recommend (b)+(a): same small model, both recover the truth, and the gradient fit uses materially fewer evaluations. Keep it deterministic (fixedrandom_seed) so it isn't flaky.Part B — becker smoke test
A smoke test mirroring
examples/becker_d2d_gradient/(the D2D EpoR methodological reference: multi-start → TRF) driven through PyBNF's real scheduler (fit_type = trf, now with multi-start), not the standalone BNGsim-direct path the reference notebooks use.origin/examples/becker-d2d-gradient(an Antimony modelBIOMD0000000271.ant,becker_d2d_data.npz, a README, and two notebooks — all standalone, no scheduler).main(undertests/), exercising the SBML/Antimony gradient path end-to-end (the measurement-model layer + SBML forward sensitivities the assembly already supports). It does not require merging the notebooks.Optional, separate from the test deliverable
Decide whether to merge the
examples/becker-d2d-gradientbranch as the on-mainstandalone reference example (the notebooks + data + README #386 points at). This has independent docs/example value but is not required to close deliverable 6 — the smoke test can ship with just its own fixtures. Track/merge it on its own merits.Done criteria
de, and to an at-least-as-good objective).fit_type = trfmulti-start through the scheduler to completion, with the needed model/data fixtures landed undertests/.main, or explicitly deferred.References
tests/recovery_harness.py(_ALGORITHMS,build/drive).examples/becker_d2d_gradient/on branchorigin/examples/becker-d2d-gradient.