ARSpy – Adaptive Rejection Sampling for Python


Build Status Docs Coverage Pypi_

This package provides a pure python/numpy implementation of adaptive rejection sampling as proposed by P. Wild, W.R. Gilks in Algorithm AS 287: Adaptive Rejection Sampling from Log Concave Density functions.

Under the (frequently satisfied) assumption that the target distribution to sample from has a log-concave density function, this algorithm allows us to sample without calculating any integrals.

This sampling method is exact (all resulting samples are i.i.d) and efficient and our implementation can handle any univariate log-concave distribution.

One prime use case is Gibbs sampling, where one frequently encounters many 1D log-concave distributions.


Simply run:

pip3 install ARSpy

Indices and tables