Repository navigation
Commit 8e5a3bf
Add
PEtab v2 has no `parameterScale`. Converting a v1
`parameterScaleNormal(μ, σ)` prior on a `log10`-scaled parameter to
`log-normal(μ ln10, σ ln10)` keeps the prior distribution, but adds a
Jacobian term to the v2 MAP objective, which moves the optimum by `−σ²
ln10` decades. No v2 prior over the unscaled parameter can preserve both
the distribution and the optimum.
`petab1to2` and `petab_files_1to2` get a `reparametrize` argument, which
uses `petab.v2.reparametrize_log` (#560) to estimate `log10_<id>` (or
`log_<id>`) instead of `<id>`:
* `"none"` (default): current behaviour, now with a warning for
converted `parameterScale*` priors
* `"priors"`: log-scaled parameters with `parameterScale*` priors
* `"all"`: all estimated log-scaled parameters without priors on linear
scale (i.e., without `logNormal`, `uniform`, ...); this also preserves
the v1 default prior (uniform on parameter scale)
Log-scaled parameters sharing a placeholder with selected parameters are
added. Such placeholders are substituted by `10^placeholder`, so numeric
overrides are log-transformed. Since overrides must be finite, `0`
overrides are replaced by a new fixed parameter `negative_infinity` with
nominal value `-inf` (assuming PEtab-dev/PEtab#687 is accepted). With
`"all"`, parameters without parameter-scale priors are skipped (with a
warning) if their placeholder can't be log-transformed, i.e., if it is
also overridden by negative numbers or by parameters that are not
reparametrized. Parameters with `lowerBound = 0` (allowed in v1 for
log-scaled parameters with an initialization prior) get `lowerBound =
-inf` on log scale (PEtab-dev/PEtab#682). They are skipped with a
warning if their prior on log scale would be an improper uniform prior,
i.e., the v1 default prior if other estimated parameters have priors.
Also fixes `petab1to2` adding default `uniform` priors to non-estimated
parameters, and to all parameters if the v1 parameter table has an
`objectivePriorType` column, but no estimated parameter has a prior.
Priors of non-estimated parameters are converted as before.
Non-estimated parameters are only reparametrized if they share a
placeholder with selected parameters. A nominal value of `0` then
becomes `-inf`, assuming PEtab-dev/PEtab#685 / PEtab-dev/PEtab#687 is
accepted. Their `parameterScale*` priors are converted to log scale as
well, unless they depend on missing bounds (then they are dropped with a
warning).
Checked on the benchmark collection: all 35 problems convert and pass v2
linting with `"all"` (now also tested in CI); with `"priors"`, 44
parameters are reparametrized in Bachmann, Isensee, Raimundez and
Schwen.
Checked with AMICI (v1 importer vs. v2 `PetabImporter`, forward
sensitivities) on 30 benchmark problems converted with `"all"` (5 large
ones excluded), at the nominal parameters and at a shifted point:
log-likelihoods agree to a relative difference of ≤ 2e-8, and gradients
agree to ≤ 2e-5 of the largest gradient entry, except for Crauste at the
nominal parameters (4e-4 at rtol/atol 1e-12/1e-16, decreasing with
tighter tolerances; 5e-14 at the shifted point). The remaining
deviations are due to integration tolerances. Log-priors are identical
for Bachmann, Isensee and Raimundez. (Before the `0` overrides were
supported, 6 log-scaled Bachmann parameters couldn't be reparametrized,
and their v1 default prior became a linear `uniform`, which preserves
the MAP, but changes the log-prior by a constant.)
The default is `"none"` for now, to keep `petab1to2` uninvasive, i.e.,
to not change the parametrization unless requested. Open to change.
References Benchmarking-Initiative/Benchmark-Models-PEtab#333,
PEtab-dev/PEtab#680, PEtab-dev/PEtab#683
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>petab1to2(reparametrize=...) (#539)1 parent ce80233 commit 8e5a3bf
5 files changed
Lines changed: 957 additions & 30 deletions
File tree
- petab/v2
- tests/v2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
0 commit comments