Skip to content

Add explanatory notes to bayes_nonconj: NUTS and variational inference#918

Merged
jstac merged 3 commits into
mainfrom
bayes-nonconj-nuts-note
Jun 19, 2026
Merged

Add explanatory notes to bayes_nonconj: NUTS and variational inference#918
jstac merged 3 commits into
mainfrom
bayes-nonconj-nuts-note

Conversation

@jstac

@jstac jstac commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Two short pedagogical additions to bayes_nonconj.md for first-time readers.

1. What is NUTS?

A {note} where NUTS is introduced (the MCMC bullet in the Overview): NUTS is a form of Hamiltonian Monte Carlo, itself a Metropolis–Hastings method, whose proposals use gradient (derivative) information about the log-posterior and which auto-tunes the trajectory length. Links to https://python-advanced.quantecon.org/mcmc.html for an MH introduction.

2. Why variational inference?

A "Why variational inference?" subsection at the VI introduction, answering why we'd use VI when NUTS already gives accurate posteriors:

  • Scale — MCMC evaluates the full-data likelihood every step and needs more steps as dimension grows; VI optimizes the ELBO with stochastic/mini-batch gradients (as in deep learning), so it scales to large datasets and high-dimensional models.
  • Yields a cheap, reusable parametric approximation.
  • Cost: accuracy — only the best fit within the guide family; can understate uncertainty.
  • Closes with a rule of thumb for choosing MCMC vs VI.

Both are prose-only; no code changed. File still parses via jupytext and code cells are intact.

🤖 Generated with Claude Code

jstac and others added 2 commits June 19, 2026 08:36
Most readers meeting NUTS will not know what it is. Add a {note} where
it is introduced: NUTS is a form of Hamiltonian Monte Carlo, itself a
Metropolis-Hastings method, whose proposals use gradient information
about the log-posterior (and which auto-tunes trajectory length). Point
to the advanced MCMC lecture for a Metropolis-Hastings introduction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
VI was introduced without saying why one would use it given NUTS. Add a
"Why variational inference?" subsection: VI scales to large datasets and
high-dimensional models (stochastic/mini-batch ELBO gradients, as in
deep learning) where MCMC is too slow, and yields a cheap reusable
approximation — at the cost of accuracy (best fit within the guide
family). Includes a rule of thumb for choosing MCMC vs VI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jstac jstac changed the title Explain NUTS with a note for first-time readers Add explanatory notes to bayes_nonconj: NUTS and variational inference Jun 18, 2026
The diagnostics step assumed familiarity with convergence, ArviZ, R-hat,
ESS, and trace plots. Expand it for a newcomer: why MCMC output must be
checked (dependent chain must reach its stationary distribution; run
multiple chains and check agreement), what ArviZ is, what r_hat and the
effective sample sizes mean, and how to read a trace plot (both panels
of plot_trace).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-918--sunny-cactus-210e3e.netlify.app

Commit: 0331bd6

📚 Changed Lectures


Build Info

@jstac jstac merged commit 5bf4394 into main Jun 19, 2026
1 check passed
@jstac jstac deleted the bayes-nonconj-nuts-note branch June 19, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant