-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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_to_inference_data argument for posterior predictive sampling functions #4021
Conversation
Have you thought through the following particular use case?
The only reason I bring this up is that for my application, I ended up using two separate arviz objects because the dimensions were different due to the different number of examples in the training and test+PPC cases. |
I can possibly see if this branch fits in with my existing code to see if I have any more "concrete" feedback. |
I'm wondering how |
The test failure looks like a false positive coming from Matplotlib, since master is also failing. |
As far as I know, it's not possible to follow this workflow, because you can't change the shape of variables with To do that kind of out of sample prediction, you need to create a new model, rather than changing the old one, and you need to use |
Are you 100% sure about the shape limitation? I was able to implement a working version of this workflow already, including changing the number of observations. |
Sure, give me a couple of days and I can post an example. |
eff0fac
to
862ff2e
Compare
Codecov Report
@@ Coverage Diff @@
## master #4021 +/- ##
=======================================
Coverage 88.95% 88.95%
=======================================
Files 92 92
Lines 14806 14817 +11
=======================================
+ Hits 13170 13181 +11
Misses 1636 1636
|
Here's the example you requested, which I think is partially relevant to this PR:
|
If I understand the conversation above correctly, @kyleabeauchamp and @rpgoldman were talking about a corner case where users could change the shape of If that does happen, users coud still fall back to not using the new feature this PR is about, right? |
I'd be a lot happier with that alternative if it didn't potentially lead to corrupting the contents of the inference data object in ways that the user might find very confusing. If it was possible to detect and raise an error on cases where bad things would happen, then I would agree with you. Is there some way we could check and see that the dimensions of the posterior predictive trace are consistent with the other information in the inference data, and raise an error if not? To be honest, this is yet another knock-on problem from the I don't agree that users could fall back to not using the new feature, because there is no way for them to understand what has gone wrong, or when the feature is/is not appropriate to use. The large number of |
@rpgoldman @michaelosthege @kyleabeauchamp I'm lining up PRs for release 3.10 (for which this one is marked right now). I understand there's still some discussion on whether it should go in or not? It would be great if you could give an update on the status here. (I must admit I don't immediately understand all the subtleties.) |
I gave my feedback a few days ago. Waiting for response. Key question: can we detect when One other thing -- is there a reason why |
Thanks for the explanation. @michaelosthege any thoughts on the above? It would be good to make a decision on whether this should go in 3.10 or not. |
Hm..
This way we can push this PR over the 3.10 finish line. |
I agree with your first point, but with respect to your second, I'm still reluctant to release a feature that could lead to further confusion on the part of people doing out of sample prediction with PyMC3, or using The real answer is probably to have a document giving a recipe for doing out-of-sample prediction, but I won't have an opportunity to draft such a thing until at least the new year. |
@rpgoldman @Spaak then shall we defer this PR to after 3.10? After all there's some chance that we can fix some of these shape issues with |
@michaelosthege @Spaak I could go either way. My big question is the following: Will this make things more difficult for people in the corner cases? and I don't know the answer. If this is only going to fail in cases where the PyMC3 is already failing, then this is no worse, and we might as well let it go. If you have a feeling about this, I defer to your decision on whether this should be merged now or later. Since I don't fully understand the implications, and don't have time to experiment myself, I am inclined to be cautious. But I may be over-cautious. |
@michaelosthege @rpgoldman My take would be: only include in the release stuff we're reasonably sure about; so, let's leave it until after 3.10 indeed. Especially since some of the shape stuff will be touched later on anyway. |
Just like for a few other open PRs I'm adding the "won't fix" label, because we'll have to re-evaluate this problem after the big |
@michaelosthege You asked about rebasing this for using in v4. I'm afraid that I have been away from PyMC3 for some months so... what would be the branch I should rebase onto? |
V4 has been merged into |
Looks like the directory structure has been changed radically and the file |
I think the fast ppc is gone, only the main ppc and the ppc_w in sampling.py remain (the latter still needs to be refactored) |
I'm going to close this as unrecoverable: the underlying code has moved too far for this branch to be applied to main (and I think that's probably good: the original posterior predictive samplers were over-complicated and kludgy). We should just try a different way to return |
When completed, this will allow programmers to have posterior predictive sampling add the posterior predictive samples to an
InferenceData
argument from which it gets its posterior distribution.This would return an
InferenceData
object, by default, when it is invoked with anInferenceData
object as argument.The idea is to make it so that users don't have to figure out how to insert the samples into the right groups themselves.