Then I sample a trace with NUTS and MCMC, like so:
nuts_kernel = NUTS(model, adapt_step_size=True)
mcmc_run = MCMC(nuts_kernel, num_samples=100, warmup_steps=30).run(inp, outp)
Now that I have a trace of sampled weights for my BNN, I would like to run my model on new data, with parameters from my trace. This feels like something that should be easy to do, but I can’t quite find how to do this in the documentation. What is the canonical way?
The resampling is needed since you may have K samples from MCMC, and might want to draw N samples from your predictive distribution where N could more more than K. I will be refactoring the TracePredictive class, so please feel free to add any suggestions on improving the interface in Make AbstractInfer classes lazily consume traces · Issue #1725 · pyro-ppl/pyro · GitHub.