bayesflow.benchmarks.lotka_volterra module#
- bayesflow.benchmarks.lotka_volterra.prior(rng=None)[source]#
Generates a random draw from a 4-dimensional (independent) lognormal prior which represents the four contact parameters of the Lotka-Volterra model.
- Parameters:
- rngnp.random.Generator or None, default: None
An optional random number generator to use.
- Returns:
- thetanp.ndarray of shape (4,)
A single draw from the 4-dimensional prior.
- bayesflow.benchmarks.lotka_volterra.simulator(theta, X0=30, Y0=1, T=20, subsample=10, flatten=True, obs_noise=0.1, rng=None)[source]#
Runs a Lotka-Volterra simulation for T time steps and returns subsample evenly spaced points from the simulated trajectory, given contact parameters theta.
See https://arxiv.org/pdf/2101.04653.pdf, Benchmark Task T.10.
- Parameters:
- thetanp.ndarray of shape (2,)
The 2-dimensional vector of disease parameters.
- X0float, optional, default: 30
Initial number of prey species.
- Y0float, optional, default: 1
Initial number of predator species.
- TT, optional, default: 20
The duration (time horizon) of the simulation.
- subsampleint or None, optional, default: 10
The number of evenly spaced time points to return. If None, no subsampling will be performed and all T timepoints will be returned.
- flattenbool, optional, default: True
A flag to indicate whather a 1D (flatten=True) or a 2D (flatten=False) representation of the simulated data is returned.
- obs_noisefloat, optional, default: 0.1
The standard deviation of the log-normal likelihood.
- rngnp.random.Generator or None, default: None
An optional random number generator to use.
- Returns:
- xnp.ndarray of shape (subsample, 2) or (subsample*2,) if subsample is not None,
otherwise shape (T, 2) or (T*2,) if subsample is None. The time series of simulated predator and pray populations