sbi icon indicating copy to clipboard operation
sbi copied to clipboard

Refactor Pyro MCMC methods

Open janfb opened this issue 1 year ago • 0 comments

Problem

The current setup for using Pyro MCMC methods is a bit of a mess:

  • we have a pyro-specific MCMC class in sbi/samples/mcmc/mcmc.py [1]
  • a pyro-specific implementation of a slice-sampler in sbi/samples/mcmc/slice.py [2]

In mcmc_posterior we offer a MCMC sampling via pyro, e.g., pyro slice sampling via [2], and HMC and NUTS as implemented in pyro.

To me it seems we are never using the class defined [1] but instead use from pyro.infer.mcmc.api import MCMC to specify the MCMC kernel (slice, hmc, nuts).

Solution

Define a common interface for pyro MCMC methods in sbi. It should be possible use our own pyro slice sampler, or plug in pyro-based HMC or NUTS (or other pyro samplers). This could include:

  • get rid of [1]
  • rename slice.py to slice_pyro.py and add more documentation
  • rename the keyword in mcmc_posterior to slice_pyro instead of just slice.

Related / a subissue of #908

janfb avatar Mar 12 '24 16:03 janfb