Add the transformation between the inverse gamma and the exponential distributions#67
Conversation
Codecov ReportBase: 97.35% // Head: 97.38% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #67 +/- ##
==========================================
+ Coverage 97.35% 97.38% +0.03%
==========================================
Files 9 9
Lines 606 613 +7
Branches 63 60 -3
==========================================
+ Hits 590 597 +7
Misses 5 5
Partials 11 11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
460266f to
ec106ff
Compare
tests/test_transforms.py
Outdated
| assert isinstance(res.owner.op, type(at.true_div)) | ||
| assert isinstance(res.owner.inputs[1].owner.op, type(at.random.exponential)) |
There was a problem hiding this comment.
I'm a little concerned about the "longevity" of this approach (i.e. the use of type(...)), because it's always possible that at.true_div and/or at.random.exponential could be changed from Op instances to helper functions at any point in the future.
There was a problem hiding this comment.
I agree that many of the tests here are lacking. Since we know the moment of the HalfCauchy, and forward sampling is fast, we can check that the mixture gets the first two moments right.
There was a problem hiding this comment.
Those checks are fine; it's the approach to performing them that I'm concerned about.
There was a problem hiding this comment.
The only other thing I can think of is implement the equivalent exponential model and check that the structures are similar. Is that what you had in mind? I modified the test in this direction.
There was a problem hiding this comment.
The only other thing I can think of is implement the equivalent exponential model and check that the structures are similar. Is that what you had in mind? I modified the test in this direction.
That's generally better, but, to alleviate my concern, one only needs to import ExponentialRV and use that instead of type(at.random.exponential).
There was a problem hiding this comment.
Yeah. I ended up implementing the equivalent exponential model and checking that the structures are similar. This is ready for review.
ec106ff to
35477d4
Compare
35477d4 to
04590da
Compare
Moves us closer to being able to rewrite the Gibbs sampler for the Horseshoe prior #64. Once this PR and #66 are merged it will be a good time to cross the finish line with aesara-devs/aesara#1036 and refactor the library so relations work both ways #43 before going into automatic rewrites.