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

Possibility to pick number of samples for calls to posterior predictive? #739

Open
AlexanderFengler opened this issue Oct 18, 2023 · 4 comments
Labels
feature request good first issue If you want to contribute but are not sure where to get started, this issue is for you!

Comments

@AlexanderFengler
Copy link

It is often useful / sufficient for posterior predictives (examples for purposes of plotting) to be based on less than all samples from a given call to .fit().

It seems like currently one cannot pick the number of samples at the level of the posterior predictive.

Would it be possible to add this as a small feature (or allow passing through of such parameter to the pm.sample_posterior_predictive() call?

@tomicapretto
Copy link
Collaborator

It's definitely possible but not 100% trivial. Bambi does not use pm.sample_posterior_predictive() under the hood (maybe we should!). It uses pm.draw(dist(**kwargs)) and the number of draws we obtain depends on the shape of the array(s) in kwargs. To decrease the number of draws from the posterior predictive distribution we should first downsample the posterior draws. I'll check what PyMC does in these cases. Maybe the answer is that we should move to pm.sample_posterior_predictive().

@digicosmos86
Copy link

@tomicapretto We implemented a temporary solution which just samples the posterior group of the trace object and then pass it to model.predict. Do you foresee issues with this?

@tomicapretto
Copy link
Collaborator

@tomicapretto We implemented a temporary solution which just samples the posterior group of the trace object and then pass it to model.predict. Do you foresee issues with this?

Nope, I think we could use it in Bambi. Do you have it somewhere? Feel free to open a PR, or I can open one myself. Thanks!

@digicosmos86
Copy link

@tomicapretto Sure! I'll do a PR soon. Thanks!

@tomicapretto tomicapretto added the good first issue If you want to contribute but are not sure where to get started, this issue is for you! label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request good first issue If you want to contribute but are not sure where to get started, this issue is for you!
Projects
None yet
Development

No branches or pull requests

3 participants