-
-
Notifications
You must be signed in to change notification settings - Fork 53
Description
See discussion by @jstac in #569 (comment)
NumPyro uses a functional core with an imperative shell: the function here is just a specification (like writing specification down in
sympy
), and a stack of effect handlers (dynamic, thread-local) reinterprets eachnumpyro.sample(...)
during execution.
When we call
mcmc.run(...)
, the kernel (e.g., NUTS) builds a pure log-density from the model via these handlers and then does the sampling. So the handlers don’t do sampling per sa; they construct the potential function the sampler needs.
It can be a bit much for readers who just want posterior draws, so I can add a few simple notes next to the first NumPyro code cells in the previous lecture to demystify this a little.
Add discussion in the lecture Non-Conjugate Priors where it is first used.