sbi.diagnostics.get_nltp

Navigation

sbi.diagnostics.get_nltp#

get_nltp(thetas, xs, posterior)[source]#

Return negative log prob of true parameters under the posterior.

NLTP: Negative log probabilities of true parameters under the approximate posterior. The expectation of NLTP over samples from the prior and the simulator defines an upper bound for accuracy of the ground-truth posterior (without having access to it, see Lueckmann et al. 2021, Appendix for details).

If calculated for many thetas (>100), NLTP can be used as a comparable measure of posterior accuracy when comparing inference methods or settings.

Note: This is interpretable only for normalized log probs, i.e., when using (S)NPE.

Parameters:
  • thetas (Tensor) – Parameters (sampled from the prior) for which to calculate NLTP values.

  • xs (Tensor) – Simulated data corresponding to thetas.

  • posterior (NeuralPosterior) – Inferred posterior for which to calculate NLTP.

Returns:

Negative log probs of true parameters under approximate posteriors.

Return type:

nltp