Implement proper truncation for prior distributions#335
Implement proper truncation for prior distributions#335dweindl merged 31 commits intoPEtab-dev:developfrom
Conversation
90946f3 to
f4b5153
Compare
Currently, when sampled startpoints are outside the bounds, their value is set to the upper/lower bounds. This may put too much probability mass on the bounds. With these changes, we properly sample from the respective truncated distributions. Closes PEtab-dev#330.
f4b5153 to
2fd6da8
Compare
e716487 to
65ef80f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #335 +/- ##
===========================================
- Coverage 74.50% 74.08% -0.42%
===========================================
Files 58 58
Lines 6142 6221 +79
Branches 1062 1078 +16
===========================================
+ Hits 4576 4609 +33
- Misses 1158 1206 +48
+ Partials 408 406 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Move this to some v1 subfolder? Now or later is fine. But I think priors will change a lot in v2
There was a problem hiding this comment.
I was thinking about moving it to https://github.com/PEtab-dev/PEtab/ at some point. It might also be helpful for non-python petab users.
|
|
…v#341) Previously, missing `*PriorParameters` would have resulted in a KeyError.
m-philipps
left a comment
There was a problem hiding this comment.
Looks good to me, thank you! 👍
Co-authored-by: Maren Philipps <55318391+m-philipps@users.noreply.github.com>
|
I just found However, But overall it might be simpler for maintenance if we just use scipy methods, and add the few missing parts. Did you already consider this? I'm fine with reviewing then merging the current approach too, if you prefer. |
Yeah, initially I was also aiming to use more of scipy (or ideally only scipy), but I think that would make the implementation more patchy than now. We still would have had to implement the same functionality that is here now to fill the gaps, and would require more subclasses on top of that. Or we would have an interface that is less PEtab-compatible, because some distribution parameters are different in scipy.
I would go for the current implementation, but I am open to revisit that when things in scipy.stats change. |
dilpath
left a comment
There was a problem hiding this comment.
Looks great!
Just some small details/error handling as discussed
Co-authored-by: Dilan Pathirana <59329744+dilpath@users.noreply.github.com>
Return sampled parameters on the parameter scale. This broke in PEtab-dev#329 & PEtab-dev#335.
Currently, when sampled startpoints are outside the bounds, their value is set to the upper/lower bounds. This may put too much probability mass on the bounds.
With these changes, we properly sample from the respective truncated distributions.
Closes #330.
This also evaluates all priors on the model parameter scale (instead of
parameterScalescale, see PEtab-dev/PEtab#402.👀 https://petab--335.org.readthedocs.build/projects/libpetab-python/en/335/example/distributions.html