Result.check() does not check forward sensitivities: a tolerance move per column, a difference quotient, and AMICI where it is installed

Open
#1,893 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, sql
Domain
testing-qa

Research direction

Start from Result.check() and _rerun.py, which already repeat sensitivity settings. The design needs three tiers: a per-column tolerance move, a difference quotient, and an optional AMICI cross-check via parity_checks/amici_parity/_amici_sens.py. Done means a sensitivity verdict, named not_resolved columns, closed-form tests such as A' = -kA, and bngsim check exiting 6 on a diff.

Written by the indexing model from the issue text.

Description

Result.check() (#1707) judges a run's species and observables. It does not judge its forward sensitivities. A run with sensitivity_params= or sensitivity_ic= passes check() on its trajectory alone, while its dY/dθ columns go unchecked.

What is already there:

  • rerun() repeats a run's sensitivity settings (sensitivity_params, sensitivity_ic, sensitivity_method; _rerun.py), so the tolerance and grid reruns already compute the sensitivities.
  • It refuses runs whose seed it cannot reproduce: carry_sensitivities and declare_ic_sensitivity.
  • So the reruns compute what is needed, and nothing compares it.

Proposal: a sensitivity check, in three tiers

  1. Tolerance move, on by default for a sensitivity run. The same rerun at rtol/10, atol/10 is judged per sensitivity column, as species are now.
    • Each column needs a scale of its own. A raw dY/dθ mixes units across parameters, so use its peak, or the scaled (θ/y)·dY/dθ that #1883 proposes for the digest.
    • It also needs a resolution rule like not_resolved. CVODES's sensitivity error test uses its own atol per column (#177, #213), so a column near zero, or one held by the error floor, must be named as not resolved, not failed.
    • Mind check()'s lesson: no global share cut. A small column beside a large one has to be judged at its own scale.
  2. Difference quotient ("all"): perturb each parameter, run again, and compare against the forward sensitivities.
    • Size the step for noise as #76 and #123 do; the notes on the FD oracle apply.
    • Both sides use the same model reader, so this checks the sensitivity solve, the RHS and the seeds, not the reading. That is where most sensitivity bugs here have been (#1799, #1801, #1805, #1825).
    • The FD reference is half the jump at a switch time (#368). A run whose switch times move with the parameters must skip or widen near them, not report a difference.
    • Cost is one rerun per parameter, so budget= must bound it, with timeout for the parameters that do not fit, as now.
  3. AMICI as a second engine ("all", and only where import amici already works). Otherwise skip with a note, as second_engine skips without libRoadRunner.
    • Reuse parity_checks/amici_parity/_amici_sens.py and its dispositions (AMICI_KNOWN_ISSUES.md).
    • Not an extra: AMICI compiles C++ per model (SWIG, a C++ toolchain, BLAS; about 20 s cold, 150–220 s for large models). It needs Python 3.12 or later. The release on PyPI (1.2.0) has the event regression that made the parity pin a main-branch commit (AMICI_PIN.json), and PyPI metadata cannot carry that pin.
    • The report should name the AMICI version and say the result was compared with a release the parity suite does not pin.

Out of scope

  • Steady-state sensitivities (#1474) and fit gradients; a later tier could reuse the same per-column rule.
  • Making AMICI a dependency or an extra.

Done when

  • check() on a forward-sensitivity run reports a sensitivity verdict per tier.
  • A per-column worst case and not_resolved columns are named.
  • Tests use closed-form sensitivities as the oracle, for example A' = -kA, where dA/dk = -t·A0·e^{-kt}.
  • A mutation pass shows each tier can fail.
  • bngsim check (#1891) exits 6 on a sensitivity diff, with no further change.

Part of #1710

Dominant language
Python
Stars
3
Forks
6
Avg merge
1d 1h
Merged PRs (30d)
295

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/bngsim

All issues in lanl/bngsim

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.