-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skip "event" dims in log likelihood group whenever necessary #1429
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @OriolAbril, LGTM! I just spotted a doctring that I think could be more explicit, and still have to check that my PyMCon model works with this change now -- will keep you posted
Co-authored-by: Alexandre ANDORRA <[email protected]>
fc8de49
to
93f64e1
Compare
Codecov Report
@@ Coverage Diff @@
## master #1429 +/- ##
=======================================
Coverage 91.58% 91.59%
=======================================
Files 105 105
Lines 11125 11136 +11
=======================================
+ Hits 10189 10200 +11
Misses 936 936
Continue to review full report at Codecov.
|
This should be ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks @OriolAbril !
I haven't had time to test it on my PyMCon model yet (as I'm still using a fork of the repo, checking out PRs is always a bit of a pain; I should just clone the actual repo now FWIW) but as you did it on the Labs code, I suggest we merge and then I'll test when it's on the master branch?
Also, why is Azure not showing up here?
I added a test on a pymc3 multinomial to be extra sure, the rest of the tests are backend agnostic at a lower level, so don't worry about it. For future reference, to quickly try the code of a PR (provided it's a PR created from a branch of the main repo) you can do
No idea, we had some issues with Azure last week, hopefully they will have solved themselves by now (we'll need a new PR to see). Azure has run and passed though, it's only an issue github reporting |
Sounds good! I'll go ahead and merge then |
Description
ArviZ schema recommends to use the same variable names in log likelihood group as the one in observed_data and posterior_predictive groups. This helps identifying to what terms does each pointwise log lik value correspond, and eases calculations like LOO-PIT.
However, log likelihood and posterior predictive don't always have the same dimensions and shape. In multidimensional observations the event dimensions (shape of a single observation) are reduced. The shape of posterior predictive is
(chain, draw, *batch_shape, *event_shape)
whereas for log likelihood it is(chain, draw, *batch_shape)
, in scalar observations they are both the same, but for multidimensional observations such as multivariate normals or multinomials the two shapes are different and the converters error out.This will automatically handle this event_shape difference provided that they follow this convention, that is, event dims are the last ones.
cc @AlexAndorra
Checklist