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
Provide access to initial values #2950
Comments
We need to answer at least the following before building this:
I would suggest grabbing the values after the |
Good question. I don't know enough of the current implementation details.
If we have to just do the parameters to avoid RNG issues then I think that's better than nothing. The parameters are of greatest interest here anyway.
Good point. Yes, constrained scale. I update the initial post. |
For new callback vs. using existing one, you could trace down how RStan uses the iterations. The RNG issue just means we can't call the var_context to print and then call it again for sampling because the RNG state won't match. Similarly, we can generate transformed parameters and generated quantities as long as we only do it once. Those only come out on the constrained scale. |
this is doable given the instantiated model and the var_context for the initial parameters - it would be very similar to how the standalone generated quantities method works. |
Sorry about the late reply. There's actually an https://github.com/stan-dev/stan/blob/develop/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp#L51 It's on the unconstrained scale. There are convenience functions to get it back to the constrained scale. To get to the original post, @jgabry, I think it's a matter of writing it out... it's already there. |
in CmdStan |
That's right. It just needs to be stored somewhere. As a prototype, if you replaced that writer with one that writes out to |
I understand that it needs to be stored somewhere. |
If you replace that line linked (command.hpp L154) with this one, it'll print out right before the first iteration:
It looks something like this...
where
Got it. That, I have no good solution... we could put it in as the first line of the CSV, but that would wreak havoc with an off-by-one error everywhere. We could add it as a comment, but that's not super useful. We could write it to a different file... These all seem non-optimal. |
exactly. |
Thanks for the additional info. I agree none of these are optimal, but writing it to a different file seems like the least bad of the non-optimal solutions ;) |
We've recently discussed how CmdStan does not have a way to provide users access to the initial values it used:
It sounds like this is actually an io/services issue because the contents of a stan::io::var_context object would need to be dumped to text. Is that right?
I don't know how difficult this would be, but to me providing access to this information seems pretty important.
The most important information to convey to users I think would be inits for parameters on the constrained scale. Transformed parameters, generated quantities, and the unconstrained scale, are potentially useful but not as high of a priority.
The text was updated successfully, but these errors were encountered: