[mix_model] Update lecture to use JAX#773
Conversation
|
📖 Netlify Preview Ready! Preview URL: https://pr-773--sunny-cactus-210e3e.netlify.app (edcf32c) 📚 Changed Lecture Pages: mix_model |
|
🤖 Status note for a future session — from a maintainer investigation on 2026-07-08 into why open-PR previews 404. Context only, not instructions. Netlify preview: https://pr-773--sunny-cactus-210e3e.netlify.app/ currently returns 404. Why previews are down (repo-wide findings)1. This branch is stale — 93 commits behind 2. The arviz failure was a red herring — do NOT pin arviz or rewrite plotting. A 2026-07-07 rebuild also failed in Note on recent timeline activityThis PR was close/reopened on 2026-07-07 by a maintainer session purely to trigger a rebuild test — not a content change. That rebuild failed on the stale-branch issue above. Apologies for the notification churn. Recommended first step for this PRUpdate this branch to This PR touches: |
📖 Netlify Preview Ready!Preview URL: https://pr-773--sunny-cactus-210e3e.netlify.app Commit: 📚 Changed LecturesBuild Info
|
3720ab6 to
8fb166f
Compare
Rebased onto main (post #642 style pass). Converts the Numba/NumPy simulation code to JAX (jax.random keys, jax.lax.scan, jax.vmap), superseding the interim np.random Generator migration (#978). Randomness uses explicit jax.random.key threading (keys passed into simulate / draw_lottery / draw_lottery_MC / simulate_mixed / plot_π_seq / π_lim, split where needed) rather than deriving seeds from parameter values, matching the JAX conversion style guide. draw_lottery_MC uses jax.scipy.stats.beta.cdf, so the lecture no longer touches NumPy's legacy RNG. Single seed 42 throughout. Verified: full lecture (JAX cells + numpyro NUTS MCMC) runs end-to-end on CPU; MC draws match the target mixture density. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bring the lecture into full style-guide compliance:
- figures: remove matplotlib titles (ax.set_title), drop hard-coded
figsize, use lw=2 on all line charts, lower-case axis labels
- math: \mathbb{E} / \mathbb{P} for expectation/probability, \mathrm{Beta}
for the distribution name, \log instead of log
- writing: IID (not i.i.d.), Bayes' law (not Bayes' Law / Bayes law)
- doclinks: same-series links use the [](name) auto-title form and drop
the generic 'this quantecon lecture' text
- code: don't pip install jax at the top (GPU admonition covers it),
remove the unused pandas import
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Many thanks @kp992 , merging |
Updates the lecture
mix_modelto use JAX instead of numba jit and vectorize functions. Also fixes some minor typos and code styling issues.