Skip to content

Improve random for ObservedRV #3036

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

Merged
merged 1 commit into from
Jun 18, 2018
Merged

Improve random for ObservedRV #3036

merged 1 commit into from
Jun 18, 2018

Conversation

junpenglao
Copy link
Member

@junpenglao junpenglao commented Jun 18, 2018

To generate random array for ObservedRV in sample_ppc and sample_prior_predictive a shape kwarg sometimes is needed to make sure the generated array has the same shape as the observed.

This PR improved that to make sure the shape is inferred during random number generation.

Previously I tried to add the shape attr to ObservedRV at the model creation, but turns out it breaks the sample_ppc for theano.shared observation. I try a different approach here to always reset the distribution shape at generation.

To generate random array for ObservedRV in sample_ppc and sample_prior_predictive a shape kwarg sometimes is needed to make sure the generated array has the same shape as the observed.
This PR improved that to make sure the shape is inferred during random number generation.
Previously I tried to add the shape attr to ObservedRV at the model creation, but turns out it breaks the sample_ppc for theano.shared observation. I try a different approach here to always reset the distribution shape at generation.
@junpenglao
Copy link
Member Author

first_try

@junpenglao junpenglao requested a review from ColCarroll June 18, 2018 10:26
@ColCarroll ColCarroll merged commit 1e5867f into pymc-devs:master Jun 18, 2018
@junpenglao junpenglao deleted the sample_generative_cleanup branch June 18, 2018 11:24
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.

2 participants