cogwheel.prior_ratio.PriorRatio

class cogwheel.prior_ratio.PriorRatio(numerator, denominator)

Bases: object

Compute the ratio of two priors.

The ratio of two distributions is coordinate invariant (so long as the two distributions use the same coordinates); we will take the ratio in the space of standard_params, which are expected to be the same between different priors. However, prior densities in cogwheel are naturally defined in the space of sampled_params, so we need the Jacobian of the inverse_transform(). This is implemented as an optional method of the cogwheel priors, ln_jacobian_determinant().

For convenience and efficiency, we skip computation of some Jacobians in the following situation: if the priors are instances of cogwheel.prior.CombinedPrior and they have some subpriors in common, then they can be “canceled out” without computing them. In this case it is allowed to leave some Jacobians undefined, only the subpriors that differ need to have their Jacobians defined. In particular this allows to deal with cases where the number of sampled and standard parameters are not the same (e.g. FixedPrior).

Parameters:
numerator, denominatorcogwheel.prior.Prior

Priors that define the ratio.

Methods

ln_prior_ratio

Return natural log of the ratio of prior densities.

ln_prior_ratio(**parameters)

Return natural log of the ratio of prior densities.

Parameters:
**parameters

Values for standard and conditioned-on parameters, they should contain (at least) the parameters required by the subpriors that are not shared by the numerator and denominator.