run_importance_sampling

run_importance_sampling(
    neglogfxs_irt: Tensor,
    neglogfxs_exact: Tensor,
    self_normalised: bool = False,
)

Computes the importance weights associated with a set of samples.

Parameters

neglogfxs_irt : Tensor

An \(n\)-dimensional vector containing the potential function associated with the DIRT object evaluated at each sample.

neglogfxs_exact : Tensor

An \(n\)-dimensional vector containing the potential function associated with the target density evaluated at each sample.

self_normalised : bool = False

Whether the target density is normalised. If not, the log of the normalising constant will be estimated using the weights.

Returns

res : ImportanceSamplingResult

A structure containing the log-importance weights (normalised, if self_normalised=False), the estimate of the log-normalising constant of the target density (if self_normalised=False), and the effective sample size.