Sometimes the init fails. Should we save what's left?
I'm inclined to leave it how it is because an init failure
is a serious problem.
If we make this too easy, I worry that users are going to
remove chains that get stuck and make other changes with
subtle (or not-so-subtle) effects on detailed balance.
We got a request on the users list that I'd at least
like to reply to.
- Bob
Particularly when doing parallel calculations, failures cause problems
(I've also had failures because of insufficient RAM):
> sflist <- mclapply(1:3, function(i) stan(fit=rb, data=stanDat, iter=8000, chains=1,
+ seed=seed, chain_id=i, refresh=-1,
+ warmup=500, thin=4),
+ mc.cores=3)
Initialization failed after 100 attempts. Try specifying initial values, reducing ranges of constrained values, or
reparameterizing the model.
error occurred during calling the sampler; sampling not done
> a10 <- sflist2stanfit(sflist)
Error in sflist2stanfit(sflist) :
each 'stanfit' object in 'sflist' must contain samples
Wish #1: sflist2stanfit would combine all the valid runs. There may be
some subtleties in terms of the reported number of chains/iterations,
since using the original request isn't right.
Wish #2: make it easier to identify which objects have useable results.
My first thought was
> lapply(sflist, class)
[[1]]
[1] "stanfit"
attr(,"package")
[1] "rstan"
[[2]]
[1] "stanfit"
attr(,"package")
[1] "rstan"
[[3]]
[1] "stanfit"
attr(,"package")
[1] "rstan"
Nope, they all have the same class.
Reading the fine manual, I think the mode slot has the info I want.
> lapply(sflist, function(x) x@mode)
[[1]]
[1] 0
[[2]]
[1] 2
[[3]]
[1] 0
Wrapping that in an is.valid function (or some similar name) would be
helpful.
Ross Boylan
--
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.
For more options, visit
https://groups.google.com/groups/opt_out.