I am trying to run the NUTS sampler several separate times, but want them to contribute to the same chains. However, every single time I run it, I have to run the initialization all over again; this takes up a lot of time. Is there anyway to run the initialization once and have it carry over to the next time I run the sampler?
There are some pointer here: Initialzing NUTS with covariance matrix as mass matrix
Here’s the code I’ve been trying to implement:
from pymc3.step_methods.hmc import quadpotential
with rmodel:
trace = pm.sample(draws=1000, tune=1000, chains=4, cores=4)
cov = np.atleast_1d(pm.trace_cov(trace))
start = list(np.random.choice(trace, 4))
potential = quadpotential.QuadPotentialFull(cov)
with model:
step = pm.NUTS(potential=potential)
trace1 = pm.sample(100, tune=0, step=step, chains=4, cores=4)
However, the second sampling runs around 1 step per second and is very slow. Any suggestions?
I’m also curious if there is any way I can use pm.sampling.init_nuts. I haven’t found any examples of it being used.