Reuse tuning for next sampling call

The best way to do is to use the trace from previous sample to initialized the NUTS sampler (we have something similar in https://github.com/pymc-devs/pymc3/blob/f375f27fdcf6568dd662d8db4474497b9bda1f58/pymc3/sampling.py#L1477-L1488)

with model1:
    init_trace = pm.sample(draws=1000, tune=1000)

from pymc3.step_methods.hmc import quadpotential
cov = np.atleast_1d(pm.trace_cov(init_trace))
start = list(np.random.choice(init_trace, chains))
potential = quadpotential.QuadPotentialFull(cov)

with pm.Model() as model_new: # reset model. If you use theano.shared you can also update the value of model1 above
    step = pm.NUTS(potential=potential)
    trace = pm.sample(1000, tune=100, step=step) # good to still do a bit of tuning
2 Likes