我试图比较两个非常相同但略有不同的模型的运行时间 . 但是根据采样的随机数,链条总是会占用非常不同的时间 . 所以我试着解决这个问题,为 stan()
提供相同的 seed
参数 .
我试过两次运行相同的模型 . 不幸的是,我发现即使是相同的种子也不能保证这个过程会产生相同的样品!两条链中的链条运行时间也非常不同!
100 iterations, 50 warmup, 15 chains
1st run: total 57.42 seconds, chain 14: 4.515 seconds, chain 15: 2.782 seconds;
2nd run: total 76.99 seconds, chain 14: 2.703 seconds, chain 15: 4.125 seconds.
-
如何种子不能保证斯坦的链条相同?
-
如何保证这一点?
以下选项用于运行Stan(rstan版本2.5.0):
t1 <- proc.time()
out7.5b <- out <- stan(fit = fit7.5b, data = win.data, init = inits,
pars = params,
iter = ni, warmup = nb, chains = nc, seed = 123)
t2 <- proc.time()
print(t2 - t1)