gwinferno.pipeline.analysis.per_event_log_bayes_factors#

per_event_log_bayes_factors(weights, log=False)[source]#

Calculates per-event log Bayes factors via importance sampling

\[\mathrm{BF}_i = \int p(d_i|\theta)p(\theta|\Lambda) d\theta \approx \frac{1}{N_s}\sum_{j=1}^{N_s} \frac{p(\theta|\Lambda)}{p(\theta|\Lambda_\emptyset)}\]
Parameters:
weightsjax.DeviceArray

JAX array of weights to integrate over. Expected size of (N_events,N_samples).

logbool, optional

Flag to perform calculations in log probability. Interprets weights as log weights. This should be more numerically stable in general but can break autograd with truncated models.

Returns:
jax.DeviceArray

Array of per-event log bayes factors.

jax.DeviceArray

Array of per-event log effective samples sizes from Monte Carlo integrals.

jax.DeviceArray

Array of per-event estimated variances from log of Monte Carlo integrals.