Open avehtari opened 3 years ago
Thanks Aki. I like the idea of hinting to the user in the error message that the problem could be due to a small value of sig_figs
.
@rok-cesnovar I think it would be preferable to do this in CmdStan itself since this would be an issue for CmdStanPy as well, but would it be possible possible for the CmdStan generate quantities method to catch and modify exceptions from Stan math?
but would it be possible possible for the CmdStan generate quantities method to catch and modify exceptions from Stan math
Right now no and I am not really sure how big of a refactor that would be
The cleanest solution for these cases would definitely be to finally move to a binary output format. That would fix a bunch of these precision issues.
Running generated quantities block that works fine with
sampling()
method can fail withgenerate_quantities()
method. This is caused as by defaultsig_figs=6
and thus the mapping to rounded stored values and back can produce wrong result. This is not a bug, but the error message is not helpful. Possible actionssig_figs
The fixes might actually go to cmdstan, but as my example below uses cmdstanr I'm submitting the issue here.Reproducible example (with high probability). Stan code
Sampling goes fine
Generating quantities
fails with an error
The same example works with
datat <- list(mu=array(c(0.3,0.6)));
If it would happen that the user would have a very time consuming sampling result, it's possible to work around the constraint by creating another model code with unrestricted parameter type.