HMC with user defined MH acceptance test

Hello!

I am the new guy in Pyro, and I can not find the answer in the tutorial.

I want to use Hamiltonian Monte Carlo with user defined Metropolis Hastings acceptance test (slightly different from the standard MH). So I do not need the wrapper of MCMC. I just want to reuse HMC kernel, sample from it to get a new candidate, smth like that:

hmc_kernel = HMC(model, step_size=0.0855, num_steps=4)
new_point = hmc.sample(params, data)
my_function_to_accept_new_point(new_point, data)

But HMC kernel does not take data. So what should I do?

I will be grateful for your help.

Thank You!

Hi @ChernovAndrey, you could try creating a subclass of HMC with a modified sample method. Here is the place in the HMC kernel where the MH correction is applied; you should be able to change this section and copy the rest of the code in HMC.sample.