crflynn / stochastic

Generate realizations of stochastic processes in python.
http://stochastic.readthedocs.io/en/stable/
MIT License
457 stars 82 forks source link

New Continuous Process: Non-Homogeneous Poisson #9

Open Gabinou opened 6 years ago

Gabinou commented 6 years ago

This continuous stochastic process generates points distributed according to a density function or density matrix. Can be used to generate poisson processes whose rate function varies with time, space, or any other data space.

The user would need to supply a deterministic function, or matrix representing the density in the data space, as well as the boundaries of this data space. These can be n-dimensional. Then, points are generated using the thinning/acceptance-rejection algorithm. This necessitaets the generation of a maximum lambda value in the data space using the private method _gen_lmax, generating uniformly distributed points in the space with rate lmax (in unthinned), then rejecting these points with probability proportional to the density at each generated point (getting thinned).

I found the NonHomogeneousPoissonProcess too dissimilar to inherit from the PoissonProcess. I hope this pull request is closer to being acceptable than my previous one.

Gabinou commented 6 years ago

The current re-opened pull request only works in 1D, for callable functions and not density matrices. Two generation algorithms have been implemented: the thinning algorithm and the inversion algorithm, as described in Generating Nonhomogeneous Poisson Processes by Pasupathy.