-
-
Notifications
You must be signed in to change notification settings - Fork 409
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 unconstrained/transformed variables to InferenceData #230
Comments
I like option 3! :-) If the main purpose of including unconstrained variables is to explore things like divergences, then option 1 becomes the best option as there is no motivation (other than consistency) to add BTW, shouldn't the bounds and domain information be part of a variable type (or something similar), currently we only have this for discrete and continuous variables (because we have integers and floats types). This will be super useful for circular variables as we can automatically compute proper statistics and plots for such variables. |
I think option 2 could be the easiest. If we add an option to transform everything to unconstrained space if a user wants it. That way we do not really need to add anything to the schema. Unless there is a notion on metadata somewhere. I don't think users normally would need these values. |
Vote for option 2 for the convenience of backward compatibility with pymc3 😬 |
I just came across this because I often find myself wanting access to the transformed variables in a PyMC3 trace. I often need this in order to evaluate model components after sampling (for example, I often want to plot the model prediction on a fine grid that is too large/memory intensive to save as a deterministic, but is fine to compute at a few points in a thinned chain). Right now, it looks like it would be easy enough to allow opt-in support for PyMC3 here: Lines 257 to 259 in 5957527
since |
hey dan! I think I'm generally on team option 3 still, but also on team "lets help out science". So I'm totally on board with you adding a little backdoor option to allow this on pymc3, and if you do, maybe I can open a second issue requesting help to add it to various other backends (or even rethinking the design)? |
Do we want transformed vars into the main idata or a new idata containing transformed data? Or new groups? |
I think if present they should be in the posterior, I have done this for now whenever I need to transform variables, and we have some examples on idata methods like |
I would also like to see a way to get the transformed variables in the trace. The fact that this isn't possible right now is pretty much the only reason I still use the original trace object of pymc3 quite a bit. I think I might even prefer if one of option 1 or 2 was the default behavior.
This is a lot more work if if we do not have the pymc3 trace, because we first have to manually map the values to the transformed space. |
I don't generally use unconstrained variables, but I think we should reach a decision on this and imo option 3 which is what we defaulted after not reaching a consensus is generating too much friction and extra work (like the complications in #2040 cc @karink520) to be a viable option. I think someone should write a proposal and call for a vote. I offer to write the proposal at some point next week if nobody can do it before then. If I do have to write the proposal, as I am not very familiar with the issue it would be great to know what PyMC and Stan do on this and what are the general expectations on this:
also cc @sethaxen and @mitzimorris who might be interested in the discussion |
regarding the question, does Stan return variables on the unconstrained scale, in CmdStan, sampler argument 'diagnostic_file' is used to report the model variables on the unconstrained scale. does this answer the above question? having access to the parameters on the unconstrained scale is useful if you're interested in the posterior geometry and how well an algorithm can deal with it. |
One can access the unconstrained samples with pystan, but it needs to be done explicitly. |
the underlying mechanism here is calling the Stan model class member function |
@ahartikainen suggested adding unconstrained variables to the schema somewhere. It seems like they could go
unconstrained_posterior
groupGood:
Bad:
unconstrained_prior
?posterior
groupGood:
Bad:
Good:
Bad:
The text was updated successfully, but these errors were encountered: