Skip to content

Commit

Permalink
Benchmark model tests: reduce gradient check tolerances
Browse files Browse the repository at this point in the history
Also sort test cases to avoid issues with pytest-xdist
  • Loading branch information
dweindl committed Sep 27, 2024
1 parent de1804a commit af992e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_benchmark_collection_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Run Gradient Checks
run: |
pip install git+https://github.com/ICB-DCM/fiddy.git \
&& cd tests/benchmark-models && pytest ./test_petab_benchmark.py
&& cd tests/benchmark-models && pytest --durations=10 ./test_petab_benchmark.py
# upload results
- uses: actions/upload-artifact@v4
Expand Down
5 changes: 4 additions & 1 deletion tests/benchmark-models/test_petab_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"Crauste_CellSystems2017",
"Fujita_SciSignal2010",
}
models = list(sorted(models))

debug = False
if debug:
Expand Down Expand Up @@ -62,6 +63,8 @@ def test_benchmark_gradient(model, scale):
"Sneyd_PNAS2002",
"Bertozzi_PNAS2020",
"Okuonghae_ChaosSolitonsFractals2020",
"Giordano_Nature2020-False",
"Zheng_PNAS2012",
):
# not really worth the effort trying to fix these cases if they
# only fail on linear scale
Expand Down Expand Up @@ -145,7 +148,7 @@ def test_benchmark_gradient(model, scale):
sizes=sizes,
direction_ids=parameter_ids,
method_ids=[MethodId.CENTRAL, MethodId.FORWARD, MethodId.BACKWARD],
success_checker=Consistency(atol=1e-4, rtol=0.2),
success_checker=Consistency(atol=1e-4, rtol=1e-1),
expected_result=expected_derivative,
relative_sizes=not scale,
)
Expand Down

0 comments on commit af992e8

Please sign in to comment.