QuantEcon / QuantEcon/lecture-python.myst
[numpyro] Add discussions on model functions in numpyro
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 123
- Forks
- 57
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 11
Description
See discussion by @jstac in https://github.com/QuantEcon/lecture-python.myst/pull/569#issuecomment-3311078908
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the lecture “Non-Conjugate Priors” and find the first cells using NumPyro. Read the linked discussion, then add explanatory notes about model functions, effect handlers, and how mcmc.run builds the log-density; the rendered lecture should make these concepts clearer to readers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100