Skip to content
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

Fix for #3310 and some more #3319

Merged
merged 5 commits into from
Dec 22, 2018
Merged

Fix for #3310 and some more #3319

merged 5 commits into from
Dec 22, 2018

Conversation

lucianopaz
Copy link
Contributor

Added broadcast_distribution_samples, which helps broadcasting multiple rvs calls with different size and distribution parameter shapes. Added shape guards to other continuous distributions. In particular, this fixes #3310, but it also prevents similar things from happening in other discrete and continuous distributions that could encounter the same pathological behavior.

…ps broadcasting multiple rvs calls with different size and distribution parameter shapes. Added shape guards to other continuous distributions.
…t a parameter shape aware size input thanks to generate_samples.
RELEASE-NOTES.md Outdated
@@ -36,6 +36,8 @@ This will be the last release to support Python 2.
- Fixed `Rice` distribution, which inconsistently mixed two parametrizations (#3286).
- `Rice` distribution now accepts multiple parameters and observations and is usable with NUTS (#3289).
- `sample_posterior_predictive` no longer calls `draw_values` to initialize the shape of the ppc trace. This called could lead to `ValueError`'s when sampling the ppc from a model with `Flat` or `HalfFlat` prior distributions (Fix issue #3294).
- Added the `broadcast_distribution_samples` function that helps broadcasting arrays of drawn samples, taking into account the requested `size` and the inferred distribution shape. This sometimes is needed by distributions that call several `rvs` separately within their `random` method, such as the `ZeroInflatedPoisson` (Fix issue #3310).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be under the new release note (v3.6)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new note for 3.7.

@@ -964,6 +965,11 @@ def random(self, point=None, size=None):
"""
mu, lam, alpha = draw_values([self.mu, self.lam, self.alpha],
point=point, size=size)
print(mu.shape, lam.shape, alpha.shape)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont forget to remove the print

@twiecki twiecki added the WIP label Dec 22, 2018
@twiecki twiecki merged commit e67c476 into pymc-devs:master Dec 22, 2018
@twiecki
Copy link
Member

twiecki commented Dec 22, 2018

Thanks!

@lucianopaz lucianopaz deleted the iss3310 branch February 24, 2019 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shape issue when prior predictive sampling from ZeroInflatedPoisson
3 participants