sbi.utils.mcmc_transform

Navigation

sbi.utils.mcmc_transform#

mcmc_transform(prior, num_prior_samples_for_zscoring=1000, enable_transform=True, device='cpu', **kwargs)[source]#

Builds a transform that is applied to parameters during MCMC.

The resulting transform is defined such that the forward mapping maps from constrained to unconstrained space.

It does two things: 1) When the prior support is bounded, it transforms the parameters into unbounded space. 2) It z-scores the parameters such that MCMC is performed in a z-scored space.

Parameters:
  • prior (Distribution) – The prior distribution.

  • num_prior_samples_for_zscoring (int) – The number of samples drawn from the prior to infer the mean and stddev of the prior used for z-scoring. Unused if the prior has bounded support or when the prior has mean and stddev attributes.

  • enable_transform (bool) – Whether to transform parameters to unconstrained space. When False, an identity transform will be returned for theta_transform.

  • device (str | device)

Return type:

Transform

Returns: A transformation that transforms whose forward() maps from unconstrained

(or z-scored) to constrained (or non-z-scored) space.