Repository navigation
Fix ImproperEmpirical: remove Empirical inheritance, constant log_pro… - #1822
Conversation
|
@manuelgloeckler could you please review this when you have time? Thanks! |
|
Hi @manuelgloeckler, could you please trigger the CI checks for this PR? Thanks! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1822 +/- ##
==========================================
- Coverage 88.54% 86.39% -2.16%
==========================================
Files 137 143 +6
Lines 11515 17537 +6022
==========================================
+ Hits 10196 15151 +4955
- Misses 1319 2386 +1067
Flags with carried forward coverage won't be shown. Click here to find out more.
|
manuelgloeckler
left a comment
There was a problem hiding this comment.
Looks good overall. Just have one question on the log_prob adjustment.
There was a problem hiding this comment.
Agree, that this error should be adapted i.e. this will now be catched by resolve_prior introduced in adapted in #1793 . Any reason why to avoid raising here?
Effectively any method that would use these log_prob would be wrong.
So if there is not reason for allowing this I would just make this error more generic i.e. Evaluating log_prob from ImproperEmpirical is not supported, please pass a proper prior if log_prob's are required.
I can imagine it might be called by a method that aims to resolve the support i.e. that log_prob is finite. But to avoid this it might be good to impelement torch distirbutions support and return Real (i.e. full support).
|
Hi @manuelgloeckler, thanks for the suggestion! |
manuelgloeckler
left a comment
There was a problem hiding this comment.
Alright, thanks @patelshivani2283-lab for fixing. I think this reasoning makes sense.
With #1803 the ImproperPrior will anyway be catched at the build_posterior stage and will raise an error (if the prior log_prob is required). Hence lets merge this.
Thanks!
…b, fix to() #1812
This PR addresses the issues with
ImproperEmpirical:pyro.distributions.Empiricalto avoid storing simulations.torch.distributions.Distribution.log_prob()returning zeros.sample()as it is not supported..to()method to returnselfand removed invalid super call.This simplifies the implementation and avoids unnecessary memory usage.