[HN Gopher] Numpyro: Probabilistic programming with NumPy powere...
___________________________________________________________________
Numpyro: Probabilistic programming with NumPy powered by Jax
Author : lnyan
Score : 61 points
Date : 2024-11-16 12:41 UTC (10 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| ghgr wrote:
| If you are struggling to understand the README, I highly
| recommend the book _Statistical Rethinking: A Bayesian Course
| with Examples in R and Stan_ by Richard McElreath. Although the
| examples are in R, the same concepts apply to Pyro (and NumPyro)
|
| [1] https://www.goodreads.com/book/show/26619686-statistical-
| ret...
| nsingh2 wrote:
| I read through the second edition, and would recommend as well
| [1] (has numpyro, pyro, pymc code). He also has a great lecture
| series on youtube [2]
|
| [1] https://xcelab.net/rm/
|
| [2]
| https://www.youtube.com/watch?v=FdnMWdICdRs&list=PLDcUM9US4X...
| diab0lic wrote:
| For those with more experience how does (Num)Pyro compare with
| PyMC? I haven't had the good fortune of working with any of these
| libraries since before Pyro (and presumably numpyro), and with
| PyMC3 back when it used Theano under the hood.
|
| Are the two libraries in competition? Or complimentary? I've been
| playing with PyMC for a personal project and am curious what I
| might gain from investigating (Num)Pyro?
| nsingh2 wrote:
| I tired both a while back, but nothing too big or serious. One
| thing that numpyro benefits from is JAX's speed, so it might be
| faster for larger models. Though PyTensor, which is the backend
| for PyMC can apparently also generate JAX code, so the
| difference might not be drastic. The PyMC API also seemed to me
| easier to get started with for those learning Bayesian stats.
|
| One thing I remember that I disliked about PyMC was the
| PyTensor API, it feels too much like Theano/TensorFlow. I much
| prefer using JAX for writing custom models.
| ailun wrote:
| You'll lose a lot of the PyMC convenience functions with
| Numpyro but gain a lot of control and flexibility over your
| model specification. If you're doing variational inference,
| Numpyro is the way to go.
|
| You can use the Numpyro NUTS sampler in PyMC with
| pm.sample(nuts_sampler="numpyro") and it will significantly
| speed up sampling. It is less stable in my experience.
| wthomp wrote:
| This is maybe not the place, but we did some apples to apples
| comparisons between PyMC, Dynesty, and the Julia Turing.jl
| package.
|
| A little to my surprise, despite being a Julia fan, Turing
| really outperformed both the Python solutions. I think JAX
| should be competitive in raw speed, so it might come down to
| the maturity of the samplers we used.
| sampo wrote:
| I find the PyMC situation confusing. But PyMC should be able to
| use JAX in the backend:
| https://www.pymc.io/projects/examples/en/latest/samplers/fas...
| svilen_dobrev wrote:
| side note: the Pyro used here - or actually pyro-ppl - is not to
| be confused with Pyro as of python-remote-objects..
___________________________________________________________________
(page generated 2024-11-16 23:00 UTC)