Repository navigation
Reject improper Uniform and LogUniform distributions - #604
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #604 +/- ##
==========================================
+ Coverage 79.87% 79.93% +0.06%
==========================================
Files 70 70
Lines 8356 8362 +6
Branches 1516 1519 +3
==========================================
+ Hits 6674 6684 +10
+ Misses 1191 1188 -3
+ Partials 491 490 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dweindl
force-pushed
the
distributions_validate_uniform
branch
from
November 17, 2026 10:11
11ac1aa to
3883ca9
Compare
dweindl
marked this pull request as ready for review
November 17, 2026 11:17
dilpath
approved these changes
Nov 17, 2026
`Uniform` accepted any limits, e.g., `Uniform(0, inf)`, whose pdf is 0, whose cdf is nan, and which fails only when sampled, with numpy's `OverflowError: Range exceeds valid bounds`. `Uniform` now requires finite limits with `low < high` (on the scale of the underlying uniform distribution), and `LogUniform` requires `0 < low < high < inf`. In `petab.v1`, this affects start point sampling for parameters with infinite bounds or with `lowerBound=0` and log-scaled `parameterScaleUniform` priors. These already failed during sampling; they now fail when the `Prior` is created. Estimated parameters with `lowerBound == upperBound` and no prior can no longer be sampled. In `petab.v2`, `Parameter.prior_dist` reports the original prior parameters and bounds if a `uniform` prior does not overlap the parameter bounds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dweindl
force-pushed
the
distributions_validate_uniform
branch
from
November 17, 2026 14:06
3883ca9 to
81653cd
Compare
dweindl
enabled auto-merge
November 17, 2026 14:08
dweindl
added a commit
to dweindl/libpetab-python
that referenced
this pull request
Nov 18, 2026
…v#601) Implements PEtab 2.0.0 erratum E1: `lowerBound` may be `-inf`, `upperBound` may be `inf`, and if any estimated parameter has a prior, estimated parameters with infinite bounds need an explicit proper prior. * `Parameter.lb` must be finite or `-inf`, `Parameter.ub` finite or `inf`. Previously, e.g. `lb=ub=inf` was accepted. * `CheckPriorDistribution` reports estimated parameters with infinite bounds and no prior if the problem has a MAP objective. Explicit improper `uniform`/`log-uniform` priors (e.g., with infinite prior parameters) are already rejected via PEtab-dev#604. * `Problem.get_priors` and `Problem.get_startpoint_distributions` raise a `ValueError` naming the parameters with infinite (or missing) bounds and no prior, instead of the generic error from `Uniform` (since PEtab-dev#604) or, before that, an improper `Uniform` that failed on sampling. I chose this over adding a fallback-distribution argument to keep the API unchanged; a fallback could be added later if needed. * `Problem.sample_parameter_startpoints` used `get_priors`, which is empty for maximum likelihood problems, and thus always failed for them. It now uses `get_startpoint_distributions` (identical to `get_priors` for MAP problems). It also returns an `(n_starts, 0)` array if no parameters are estimated, and no longer accepts arbitrary keyword arguments. These were a leftover from copying the v1 method, where they are forwarded to `petab.v1.sampling.sample_parameter_startpoints`; in v2 they have been silently ignored since PEtab-dev#380, so nothing should depend on them. * Tests that prior truncation at bounds matching the prior's domain (e.g., `log-normal` on `[0, inf]`) is a no-op, and that one-sided infinite bounds still truncate at the finite bound. Infinite nominal values (erratum E3) were already accepted; no change. Closes PEtab-dev#565. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.v1.distributions.Uniformaccepted any limits. E.g.,Uniform(0, inf)has pdf 0 and cdf nan, and fails only when sampled, with numpy'sOverflowError: Range exceeds valid bounds.Uniformnow requires finite limits withlow < high(on the scale of the underlying uniform distribution), andLogUniformrequires0 < low < high < inf. Both raise aValueErrorotherwise.Affected
petab.v1use: start point sampling for parameters with infinite bounds, or withlowerBound=0and a log-scaled defaultparameterScaleUniforminitialization prior. These already failed during sampling; they now fail when thePrioris created.low == highis also rejected, so an estimated parameter withlowerBound == upperBoundand no prior can no longer be sampled (v1 and v2). None of the problems in the PEtab benchmark collection are affected.In
petab.v2, invaliduniform/log-uniformpriors are still reported byCheckPriorDistribution, now with a clearer hint. If auniformprior range does not overlap the parameter bounds, the error names the prior parameters and bounds instead of the clipped limits.🤖 Generated with Claude Code