Add explanatory notes to bayes_nonconj: NUTS and variational inference#918
Merged
Conversation
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>
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>
📖 Netlify Preview Ready!Preview URL: https://pr-918--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed LecturesBuild Info
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two short pedagogical additions to
bayes_nonconj.mdfor 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:
Both are prose-only; no code changed. File still parses via jupytext and code cells are intact.
🤖 Generated with Claude Code