r - How to get the time of sampling in rjags? -
i have implemented lda model rjags. , got final samples with:
jags <- jags.model('../lda_jags.bug', data = data, n.chains = 1, n.adapt = 100) update(jags, 2000) samples <- jags.samples(jags, c('theta', 'phi', 'z'), 1000)
now can use samples$theta
or samples$phi
result of theta
, phi
. how can know how long did take sample? thanks!
as @eipi10 states can use system.time() around update() call time process within r. or, can use runjags package prints (total) time taken in updating model, including previous calls extend.jags:
library('runjags') results <- run.jags('../lda_jags.bug', monitor = c('theta', 'phi', 'z'), data = data, n.chains = 1, adapt = 100, burnin = 2000, sample = 1000) results # or: jags <- jags.model('../lda_jags.bug', data = data, n.chains = 1, n.adapt = 0) runjags <- as.runjags(jags, monitor = c('theta', 'phi', 'z')) results <- extend.jags(runjags, adapt = 100, burnin = 2000, sample = 1000) results results <- extend.jags(runjags, sample = 1000) results
Comments
Post a Comment