Repository navigation
Conversation
PEtab v2 has no `parameterScale`. Converting a v1 `parameterScaleNormal` prior on a log-scaled parameter to `log-normal` keeps the prior distribution, but adds a Jacobian term to the MAP objective and moves the optimum. No v2 prior over the unscaled parameter can preserve both. Add `petab.v2.reparametrize_log`, which estimates `log10_<id>` (or `log_<id>`) instead of `<id>` and defines `<id> = 10^log10_<id>`: * parameter table: log-transformed bounds and nominal value; priors are taken from the `priors` argument or derived from `log-normal`, `log-laplace` and `log-uniform` priors * SBML model: new parameter and assignment rule for model parameters * observable/noise formulas and condition target values: substitution * measurement overrides: replaced by the new IDs, numbers are log-transformed, and the placeholder is exponentiated in the formula `petab1to2` and `petab_files_1to2` get a `reparametrize` argument: `"none"` (default, current behaviour), `"priors"` (log-scaled parameters with `parameterScale*` priors) or `"all"` (all estimated log-scaled parameters without priors on linear scale). Log-scaled parameters that share a placeholder with selected parameters are added. With `"all"`, parameters without parameter-scale priors are skipped if their placeholder can't be log-transformed. With `"none"`, a warning points to the new option. Also fix `ConditionTable.to_df`, which wrote non-numeric target values in sympy syntax (e.g., `**`) that cannot be parsed as PEtab math. References Benchmarking-Initiative/Benchmark-Models-PEtab#333 Generated with AI assistance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #539 +/- ##
==========================================
+ Coverage 77.16% 77.88% +0.71%
==========================================
Files 67 68 +1
Lines 7568 7809 +241
Branches 1349 1415 +66
==========================================
+ Hits 5840 6082 +242
+ Misses 1242 1239 -3
- Partials 486 488 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PEtab v2 has no
parameterScale. Converting a v1parameterScaleNormal(μ, σ)prior on alog10-scaled parameter tolog-normal(μ ln10, σ ln10)keeps the prior distribution, but adds a Jacobian term to the v2 MAP objective, which moves the optimum by−σ² ln10decades. No v2 prior over the unscaled parameter can preserve both the distribution and the optimum.This adds
petab.v2.reparametrize_log, which estimateslog10_<id>(orlog_<id>) instead of<id>and defines<id> = 10^log10_<id>, as recommended by the v2 spec for log-scale priors:priorsargument, or derived fromlog-normal,log-laplaceandlog-uniformpriors (other x-space priors raise)log10_<id>and assignment rule<id> = 10^log10_<id><id>→10^log10_<id>phis replaced by10^phin the formulaspetab1to2andpetab_files_1to2get areparametrizeargument:"none"(default): current behaviour, now with a warning for convertedparameterScaleNormal/Laplacepriors"priors": log-scaled parameters withparameterScale*priors"all": all estimated log-scaled parameters without x-space priors; this also preserves the v1 default prior (uniform on parameter scale)Log-scaled parameters sharing a placeholder with selected parameters are added. With
"all", parameters without parameter-scale priors are skipped (with a warning) if their placeholder can't be log-transformed (e.g., Bachmann has0offsets).Also fixes
ConditionTable.to_df, which wrote non-numeric target values in sympy syntax (**) that can't be parsed back as PEtab math.Checked on the benchmark collection: all 35 problems convert and pass v2 linting with
"all"; with"priors", 44 parameters are reparametrized in Bachmann, Isensee, Raimundez and Schwen. Objective equivalence with a simulator is not checked here (to be done in AMICI / the benchmark repo).Open points:
lowerBound <= 0currently raises (would be-infon log scale); the old→new ID map is not exposed bypetab1to2; default stays"none"until Benchmarking-Initiative/Benchmark-Models-PEtab#333 is decided.References Benchmarking-Initiative/Benchmark-Models-PEtab#333
🤖 Generated with Claude Code