cyjax.util.mc_integrate_batched#

cyjax.util.mc_integrate_batched(key, batches, batch_size, fn, sample, var)#

Monte carlo integration in batches.

This function computes the MC approximation of an integral by summing over batches of samples. This is done by repeatedly calling mc_integrate().

Parameters:
  • key – PRNG random key.

  • batches – Number of batches.

  • batch_size – Number of samples in each batch.

  • fn – Integrand, taking an array of points as input.

  • sample – Sampling function, taking a random key and an integer indicating the number of desired samples as input. Must return a tuple of samples and corresponding weights.

Returns:

MC estimate of integral.