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

Add weight_predictions function #2147

Merged
merged 9 commits into from
Nov 12, 2022
Merged

Add weight_predictions function #2147

merged 9 commits into from
Nov 12, 2022

Conversation

aloctavodia
Copy link
Contributor

@aloctavodia aloctavodia commented Oct 29, 2022

This function will take a list of idatas with posterior_predictive groups and a list of model weights (computed using az.compare or something else) and it will return a new inference data with a posterior_predictive group composed of weighted samples from the input idatas.

@zaxtax maybe we can focus on this and forgot about pm.sample_posterior_predictive_w

  • Follows official PR format
  • Includes new or updated tests to cover the new feature
  • Code style correct (follows pylint and black guidelines)
  • Changes are listed in changelog

📚 Documentation preview 📚: https://arviz--2147.org.readthedocs.build/en/2147/

@zaxtax
Copy link
Contributor

zaxtax commented Oct 29, 2022 via email

@zaxtax
Copy link
Contributor

zaxtax commented Oct 29, 2022 via email

@aloctavodia
Copy link
Contributor Author

glad you like it. yeah we are assuming a few things here, we should add some check. We may want to deprecate pm.sample_posterior_predictive_w and point people here. and also update/improve the example in PyMC-examples

@aloctavodia aloctavodia marked this pull request as ready for review October 29, 2022 20:50
@codecov
Copy link

codecov bot commented Oct 29, 2022

Codecov Report

Merging #2147 (c16de55) into main (2d88638) will decrease coverage by 0.02%.
The diff coverage is 76.19%.

@@            Coverage Diff             @@
##             main    #2147      +/-   ##
==========================================
- Coverage   90.70%   90.67%   -0.03%     
==========================================
  Files         120      120              
  Lines       12647    12667      +20     
==========================================
+ Hits        11471    11486      +15     
- Misses       1176     1181       +5     
Impacted Files Coverage Δ
arviz/stats/__init__.py 100.00% <ø> (ø)
arviz/stats/stats.py 95.25% <76.19%> (-0.62%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@ahartikainen ahartikainen left a comment

Choose a reason for hiding this comment

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

Couple of comments

arviz/stats/stats.py Outdated Show resolved Hide resolved
arviz/stats/stats.py Outdated Show resolved Hide resolved
arviz/stats/stats.py Outdated Show resolved Hide resolved
@aloctavodia aloctavodia changed the title [WIP] add weight_predictions function Add weight_predictions function Nov 2, 2022
@aloctavodia
Copy link
Contributor Author

ready for review or merge, depending on how benevolent you are feeling today

arviz/stats/stats.py Outdated Show resolved Hide resolved
arviz/stats/stats.py Show resolved Hide resolved
arviz/stats/stats.py Outdated Show resolved Hide resolved
arviz/stats/stats.py Show resolved Hide resolved
@aloctavodia aloctavodia merged commit 24e66c3 into main Nov 12, 2022
@aloctavodia aloctavodia deleted the wp branch November 12, 2022 13:51
@oussamadhaoui
Copy link

ppc_w= az.stats.weight_predictions([model0, model1, model2], weights)
I used this line and I received this error
ValueError: All the InferenceData objects must contain the posterior_predictivegroup

@aloctavodia
Copy link
Contributor Author

Hi @oussamadhaoui,

did you check that model0, model1, and model2 have the posterior_predictive group?

also for the future, it is usually the best idea to open a new issue ticket instead of adding comments to merged PRs. Check this guide

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.

4 participants