sbi.analysis.conditional_potential

sbi.analysis.conditional_potential#

conditional_potential(potential_fn, theta_transform, prior, condition, dims_to_sample)[source]#

Returns potential function that can be used to sample the conditional potential.

It also returns a transform and a prior to be used to sample the conditional potential.

The conditional potential is \(p(\theta_i | \theta_j, x_o) \propto p(\theta | x_o)\) but is a function only of \(\theta_i\).

Parameters:
  • potential_fn (BasePotential) – The potential function to be conditioned.

  • theta_transform (Transform) – The parameter transformation that should be reduced (by ignoring dimensions not contained in dims_to_sample).

  • prior (Distribution) – The prior distribution that should be reduced (by ignoring dimensions not contained in dims_to_sample).

  • condition (Tensor) – Parameter set that all dimensions not specified in dims_to_sample will be fixed to. Should contain dim_theta elements, i.e. it could e.g. be a sample from the posterior distribution. The entries at all dims_to_sample will be ignored.

  • dims_to_sample (List[int]) – Which dimensions to sample from. The dimensions not specified in dims_to_sample will be fixed to values given in condition.

Returns:

A conditioned potential function, conditioned parameter transformation, and a marginalised prior.

Return type:

Tuple[Callable, Transform, Any]