Considering the paper introducing NUTS (https://www.jmlr.org/papers/volume15/hoffman14a/hoffman14a.pdf) has the title of ‘The No-U-Turn Sampler: Adaptively Setting Path Length in HMC’ and effictively just being an HMC sampler that determines the number of steps and step size parameter automatically,
Why does it seem to be required to provide the NumPyro MCMC with a num_warmup and num_steps (even when using NUTS)?
Example code:
def run_inference(model, args, rng_key, X, Y, D_H):
start = time.time()
kernel = NUTS(model)
mcmc = MCMC(
kernel,
num_warmup=args["num_warmup"],
num_samples=args["num_samples"],
num_chains=args["num_chains"],
progress_bar=False,
)
mcmc.run(rng_key, X, Y, D_H)
mcmc.print_summary()
print("\nMCMC elapsed time:", time.time() - start)
return mcmc.get_samples()
Removing num_samples and num_chains seems to be required as removing these parameters causes:
TypeError: MCMC.init() missing 2 required keyword-only arguments: ‘num_warmup’ and ‘num_samples’
I’d like to know if I’m just doing it wrong and it is possible to let NUTS determine number of steps, or if this is some limitation of the implementation.
Thanks in advance for any responses.