QuantEcon / QuantEcon/lecture-python.myst

[numpyro] Add discussions on model functions in numpyro

Open
#622 0 comments 0 reactions 0 assignees View on GitHub

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 each numpyro.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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.