birdepy.gpu_functions.probability()
- birdepy.gpu_functions.probability(z0, zt, t, param, model, k=1000000, seed=None)
Transition probabilities for continuous-time birth-and-death processes generated using Monte Carlo on a GPU.
- Parameters:
z0 (array_like) – States of birth-and-death process at time 0.
zt (array_like) – States of birth-and-death process at time(s) t.
t (array_like) – Elapsed time(s) (if has size greater than 1, then must be increasing).
param (array_like) – The parameters governing the evolution of the birth-and-death process. Array of real elements of size (n,), where ‘n’ is the number of parameters. These must be in the order given here).
model (string, optional) –
Model specifying birth and death rates of process (see here). Should be one of:
’Verhulst’ (default)
’Ricker’
’Hassell’
’MS-S’
’Moran’
’pure-birth’
’pure-death’
’Poisson’
’linear’
’linear-migration’
’MS-S’
’M/M/inf’
’loss-system’
Custom models are not available for this function. See
birdepy.probability()
for custom models.k (int, optional) – Minimum number of samples used to generate each probability estimate. (Actual number of samples will usually be higher due to the way memory is allocated on GPU.) The total number of samples used will be at least z0.size * k.
seed (int, optional) – Seed for simulations.
- Returns:
transition_probability – An array of transition probabilities. If t has size bigger than 1, then the first coordinate corresponds to t, the second coordinate corresponds to z0 and the third coordinate corresponds to zt; for example if z0=[1,3,5,10], zt=[5,8] and t=[1,2,3], then transition_probability[2,0,1] corresponds to P(Z(3)=8 | Z(0)=1). If t has size 1 the first coordinate corresponds to z0 and the second coordinate corresponds to zt.
- Return type:
ndarray
Examples
Estimate transition probabilities for a Moran model:
from birdepy import gpu_functions as bdg param = (210, 20, 0.002, 0, 100) t = 0.2 z0 = [50, 60] zt = [55, 56, 57, 58, 59,60] bdg.probability(z0, zt, t, param, 'Moran', 10**6)
Outputs:
array([[3.09160e-02, 5.43120e-02, 8.09760e-02, 1.05968e-01, 1.23203e-01,1.27453e-01], [0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 0.00000e+00, 6.30000e-05]])
Notes
This function requires a compatible Nvidia graphics processing unit and drivers to be installed.
The packages Numba and cudatoolkit also need to be installed.
If you use this function for published work, then please cite [1].
For a text book treatment on the theory of birth-and-death processes see [2].
References