CmdStan issue with Sample(save_warmup=true, thin=2)

96 views
Skip to first unread message

Rob J. Goedman

unread,
Oct 28, 2016, 2:06:36 PM10/28/16
to stan-...@googlegroups.com
Hi,

When running a model with above Sample() settings, stansummary will fail:

MacBook-Pro:tmp rob$ /Users/rob/Projects/Stan/cmdstan/bin/stansummary simple_samples_*.csv
Warning: non-fatal error reading adapation data
Warning: non-fatal error reading adapation data
Warning: non-fatal error reading adapation data
Warning: non-fatal error reading adapation data
libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: mean: v has size 0, but must have a non-zero size
Abort trap: 6

I vaguely remember this was discussed some time ago, but just wanted to refresh the current status.

Below how I run the model (in my case from within Julia, but below the command line steps).

With thin=1 the model works file.

Thanks.
Rob

./simple sample num_samples=1000 num_warmup=1000 save_warmup=1 thin=2 adapt engaged=1 gamma=0.05 delta=0.8 kappa=0.75 t0=10.0 init_buffer=75 term_buffer=50 window=25 algorithm=hmc engine=nuts max_depth=10 metric=diag_e stepsize=1.0 stepsize_jitter=1.0 random seed=-1 init=2 id=1 data file=simple_1.data.R output file=simple_samples_1.csv refresh=100

/Users/rob/Projects/Stan/cmdstan/bin/stansummary simple_samples_*.csv

My test model:

simple.stan:

data {real sigma;}
parameters {real y;}
model {y ~ normal(0,sigma);}

simple_1.data:

"sigma" <- 1.0

Bob Carpenter

unread,
Nov 2, 2016, 6:38:10 PM11/2/16
to stan-...@googlegroups.com
Thanks for reporting. I wrote it up as an issue:

https://github.com/stan-dev/cmdstan/issues/510

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Linas Mockus

unread,
Feb 3, 2017, 4:14:43 PM2/3/17
to Stan users mailing list
Hi,

I got another error with save_warmup using 2.13.0. It runs without save_warmup but gives an error with save_warmup.

start /b 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\pbpkautojac.exe sample num_warmup=200 num_samples=1000 output refresh=10 file=1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\jac3.csv data file=1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\pbpkauto.data.r init=2

AND

start /b 1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\pbpkautojac.exe sample num_warmup=200 num_samples=1000 save_warmup= 200 output refresh=10 file=1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\jac3.csv data file=1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19\pbpkauto.data.r init=2

N:\Personal\md\pbpk\stanCmdStan_gaba>
Exception: bad lexical cast: source type value could not be interpreted as target
Diagnostic information:
Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast> >
std::exception::what: bad lexical cast: source type value could not be interpreted as target

Is this resolved in 2.14.0 - or is it an issue on my PC. I already tried on two win10 and consistently get an error.

Linas

Bob Carpenter

unread,
Feb 3, 2017, 7:42:32 PM2/3/17
to stan-...@googlegroups.com
There's a bigger issue with the sampler in 2.13, so you
should definitely move to 2.14.

You just need to pass save_warmup=1. It's a boolean.
Here's what help-all says:

save_warmup=<boolean>
Stream warmup samples to output?
Valid values: [0, 1]
Defaults to 0

Sorry for the terrible error message. The big command
refactor lands in 2.15, and hopefully the message will be
better. If not, we'll have a lot of issues to create to
clean this kind of bad behavior up.

- Bob

Daniel Lee

unread,
Feb 3, 2017, 8:12:41 PM2/3/17
to stan-...@googlegroups.com
Yes. That's terrible error handling.

First, switch to 2.14. But the warmup issue is caused by the space. It needs to be "warmup=200", not "warmup= 200".


Daniel
Reply all
Reply to author
Forward
0 new messages