pymc-devs / pymc-experimental

https://pymc-experimental.readthedocs.io
Other
75 stars 47 forks source link

Refactor to use numba #179

Open ferrine opened 1 year ago

ferrine commented 1 year ago

https://github.com/pymc-devs/pymc-experimental/blob/ae7b80fc8ad1636e8c5d178c46bd85cf3c0f2e85/pymc_experimental/distributions/discrete.py#L31

Make the random generator vectorized in numba.

The original random sampling method is pure python and when prior or posterior sampling is called a slow loop is running for sampling. Numba has similar syntax to numpy and therefore makes it easy to vectorize the sampling call. It can be implemented as a static broadcasted function that is called by this class

twiecki commented 1 year ago

Can you add more description if it's easy, maybe a good newcomer issue.