-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Control precision of sampling ASCII output #2515
Comments
From @bgoodri on April 20, 2018 20:25 This is a Stan thing rather than a RStan one, and I believe it is On Fri, Apr 20, 2018 at 4:19 PM, aaronjg notifications@github.com wrote:
|
We could double file size and clog up I/O for that extra precision, but most computations don't have much more than the residual precision we provide left over. So even though you get about 16 digits of precision in floating point, after sampling, it's usually not that accurate. Ideally, we'd have a feature to control the precison. |
I'm going to move this to being a Stan feature request. My guess is that we'll wind up providing a binary output format before fixing it, though you never know. It should be easy to extend precision, just a matter of how to control it in the calls. |
I don't particularly expect the extra precision to add much to the inference. However, as I was moving from keeping the results in memory to streaming to a file and loading them back in, I was expecting identical results and had some tests fail because of it. Having a binary output format seems ideal. |
Yeah this would be nice but at least it should be deterministic currently, so a tolerance level for the tests will work reliably. If it’s not documented anywhere we should do that too. |
The outputs aren't random now, just limited precision that's hard coded into the I/O (or taken by default---I don't even know which). I understand that this level of consistency with round trip I/O would be nice, but that's usually too much to ask for floating point.
We could get more precision---don't know if round trips are possible. The usual recommendation is to never try to compare floating point other than to within known precision.
… On Apr 22, 2018, at 5:27 PM, Jonah Gabry ***@***.***> wrote:
Yeah this would be nice but at least it should be deterministic currently, so a tolerance level for the tests will work reliably.
If it’s not documented anywhere we should do that too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This was added to cmdstan via the sig_figs argument for 2.25. Closing. |
From @aaronjg on April 20, 2018 20:19
Summary:
When writing out data to the sample file, precision is lost. The data should be the same when writing out and read back in using read_stan_csv as when using rstan.
Description:
When rstan writes to a file it only keeps the first 6 decimal places of precision, this causes the sample file to differ from what is stored in the rstan object.
Reproducible Steps:
stan.model <- compile_model("bernoulli.stan")
source(bernoulli.data.R)
out <- sampling(stan.model,chains=1,sample_file="out.csv",seed=1)
Current Output:
head -n 35 out.csv| tail
Expected Output:
If applicable, the output you expected from RStan.
File written should have the same values as the extract command.
RStan Version:
Compiled from: 4706b82028a7fc3a31cbdf6c60beed4c49233562
R Version:
"R version 3.4.4 (2018-03-15)"
Operating System:
Your operating system (e.g., OS X 10.11.3)
Ubuntu 14.04
Copied from original issue: stan-dev/rstan#518
The text was updated successfully, but these errors were encountered: