-
Notifications
You must be signed in to change notification settings - Fork 37
Makes _setval! and thus the prob-macro compatible with v4 #151
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
Conversation
Co-authored-by: Cameron Pfiffer <cpfiffer@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll provisionally approve, but since DynamicPPL isn't really my bag I'd like to see a merge in from one of the "real" DynamicPPL people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready to merge once the tests pass.
| quote | ||
| for vn in md.$n.vns | ||
| val = vec(c[Symbol(vn)]) | ||
| val = copy(vec(MCMCChains.group(c, Symbol(vn)).value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we copy-and-paste the PR comments here, so we can remind ourselves what's happening in the future?
|
There's an issue; I forgot that DynamicPPL.jl doesn't depend on MCMCChains.jl but only on AbstractMCMC.jl (which is where we get the So either we
Personally I strongly prefer option (1). At the moment I'm also a bit out of the loop here, but it's a bit strange to me if we implement methods for DynamicPPL.jl/src/prob_macro.jl Line 231 in f670195
@mohamed82008 @devmotion Maybe you guys have thought about this before? |
I don't think 2 is a good option -- So I prefer option 1 here.
I agree that it's strange. So far, we haven't moved any of the indexing functionality upstream to AbstractMCMC, and it's not clear that we would want to -- I think we are implicitly requiring |
Fair point 👍
I wouldn't say it's moot though; I'm fully aware that |
It's not necessarily intended to be a quick fix, I think my perception of why it's a moot point is that we should only really put stuff in Honestly this should probably be |
Yeah, I think we agree here: it doesn't make sense to have an abstract type for which we define behavior for if we do not also define what's expected behavior for this type.
Not sure if |
Maybe? I dunno. I could see it living in either place, really. Either way |
Agreed. Do you know if there's anything stopping us from just depending on MCMCChains for the moment? |
|
Not that I'm aware of, but I've also been very out of the loop for two months. |
|
Shouldn't the issue that this PR tries to solve be fixed by #147 without having to deal with MCMCChains directly? |
|
Ah, I did not see that! That should indeed fix the problem! But the "issue" of But I guess we should just close this PR in favor of #147 then, and maybe make an issue over at the |
|
@torfjelde what's the status for this PR? If this is already fixed by #147, maybe consider closing it? |
|
Closed in favour of #147 . |
Currently the following fails:
where
viis aVarInfoandcis aMCMCChains.Chainsif the model contains non-univariate variables. This PR provides a fix by using the newMCMCChains.namesingroupto get the corresponding index-symbols which is then used to extract the values from the chainc.The issue is that after
v4.0vi.metadata[key].vnsresults in aVarNamewhich is "identical" tokeyin the sense that even ifarepresents a multivariate variable,vi.metadata[:a].vns == [VarName(:a, ())], not the varnames corresponding to the indices for that variable. See TuringLang/Turing.jl#1352 for a related issue.