Simulator#

class bayesflow.simulators.Simulator[source]#

Bases: object

sample(batch_shape: tuple[int, ...], **kwargs) dict[str, ndarray][source]#
rejection_sample(batch_shape: tuple[int, ...], predicate: Callable[[dict[str, ndarray]], ndarray], *, axis: int = 0, sample_size: int = None, **kwargs) dict[str, ndarray][source]#
sample_batched(batch_shape: tuple[int, ...], *, sample_size: int, **kwargs)[source]#

Sample the desired number of simulations in smaller batches.

Limited resources, especially memory, can make it necessary to run simulations in smaller batches. The number of samples per simulated batch is specified by sample_size.

Parameters:
batch_shapeShape

The desired output shape, as in sample(). Will be rounded up to the next complete batch.

sample_sizeint

The number of samples in each simulated batch.

kwargs

Additional keyword arguments passed to sample().