docs: chapter 1 tutorial 4/6 review feedback - #62
Merged
Merged
Conversation
Acts on a read-through of chapter 1 tutorials 4, 5 and 6.
Tutorial 4:
- Backtick `log_likelihood_function` and `model_data` in the Analysis prose,
which the surrounding paragraphs already backtick.
- Add the six figures the tutorial has always embedded but which were never
committed: scripts/chapter_1_introduction/images/{bad,okay,good}_fit.png and
the matching normalized residual maps. All six rendered broken until now.
Generated by running the tutorial's own 15-parameter fit 25 times against one
fixed dataset and selecting three genuine outcomes: bad (logL -3189.38,
residuals to 21.6 sigma), okay (132.98, breaching 3 sigma at 4 pixels) and
good (183.63, 0 pixels above 3 sigma). The okay case matters because the
prose asserts "for the okay fit there are residuals above 3.0 sigma"; that is
now literally true of the committed image.
- Round the log likelihood in all 9 plot titles to 2dp. At full float precision
the title overflows a square figure and clips for every reader.
- .gitignore: except this images/ directory from the blanket `**/images/` rule,
which silently hid the six PNGs from `git add`.
Tutorial 6:
- Drop the `search.summary` / Resampling Info block. Tutorial 7's
__NaN Diagnostics__ section already covers that file and both NaN counters,
so the material was premature and duplicated here.
- Replace the extended ball-rolling analogy for Hamiltonian Monte Carlo with a
plain statement that NUTS is MCMC in which the walker knows which way to
step, keeping only as much trajectory as the No-U-Turn name needs. The
wrap-up recap is brought into line.
- Move the Hamiltonian diagnostics (n_divergent, ess_min, mean_acceptance) out
to tutorial 7.
- Reword the wrap-up's opening sentence.
Tutorial 7:
- New __Hamiltonian Diagnostics__ section carrying the diagnostics moved from
tutorial 6, with its own short BlackJAXNUTS fit so the numbers come from a
live result. Placed between __NaN Diagnostics__ and __Unit Cube Vs Physical__
rather than inside __Comparing Searches__, whose prose reasons about "none of
the four" searches and contrasts exactly three mechanisms.
Regenerated notebooks/ for tutorials 4, 6 and 7, and re-rendered tutorial 4's
curated markdown mirror. That mirror was last built on 2026-07-27, so this also
catches it up on four intervening script commits (c157131, 9e1b165, cd9efd8,
b599b4c) - hence the larger markdown diff and the 10 -> 14 image files.
Closes #61
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DMhAYrJ6m2spkTVEWcSKg
This was referenced Sep 14, 2026
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.
Summary
Acts on a read-through of chapter 1 tutorials 4, 5 and 6.
Tutorial 4
log_likelihood_functionandmodel_datain the Analysis prose, which the surrounding paragraphs already backtick.scripts/chapter_1_introduction/images/did not exist in this repo, so all six<img>tags rendered broken, and the prose that follows leans on them directly ("This ideal scenario is illustrated in thegood_fit.pngimage above").= 134.2557227848585) the title overflows a square figure and clips for every reader..gitignore: excepts thisimages/directory from the blanket**/images/rule, which silently hid the six PNGs fromgit add.Tutorial 6
search.summary/ Resampling Info block: tutorial 7's__NaN Diagnostics__already covers that same file and both NaN counters, so it was premature and duplicated.Tutorial 7
__Hamiltonian Diagnostics__section carryingn_divergent,ess_minandmean_acceptance, with its own shortBlackJAXNUTSfit so the numbers come from a live result.How the six figures were generated
The tutorial's own 15-parameter fit (
af.Collectionof five Gaussians,af.DynestyStatic(sample="rwalk")) run 25 times against one fixedgaussian_x5realisation, using the tutorial's own plotting blocks verbatim atfigsize=(5,5),dpi=100. Log likelihoods were recomputed from each reportedmax_log_likelihood_instancerather than taken fromresult.log_likelihood(max disagreement across all 25: 0.0).The okay case is the one that matters: the tutorial asserts "for the okay fit there are residuals above 3.0 sigma", and that is now literally true of the committed image, while the good fit breaches it nowhere. The good fit reaches the global maximum (183.63 against the generating profiles' own 180.91).
The 25 trials split into the three families the tutorial describes — 9 failed local maxima, 13 near-misses that look plausible but breach 3σ, 3 near-global solutions — so the figures illustrate a real property of this fit, not a hand-picked artefact.
Note on the markdown diff size
markdown/chapter_1_introduction/tutorial_4_why_modeling_is_hard.mdwas last rendered on 2026-07-27 (1505794), and four script commits have landed since (c157131,9e1b165,cd9efd8,b599b4c). Re-rendering it to pick up the backtick fix therefore also catches the mirror up on that drift, which is why the markdown diff is larger than the prose change and the image set grows 10 → 14 files. Verified: no other tutorial's mirror changed, and no absolute or worktree path leaked into the rendered output.API Changes
None — documentation and tutorial prose only.
Test Plan
ast.parse)..github/scripts/check_tutorials_complete.py→ 16 tutorials checked, none truncated.ball/search.summary/Resampling Info/n_divergentreference.Clipping→NaN Diagnostics→Hamiltonian Diagnostics→Unit Cube Vs Physical→Summary.af.BlackJAXNUTS,af.Collection,af.Model,af.UniformPriorall present in the installed stack; the new section'sGaussian/analysis_x1_jax/timereferences resolve earlier in the file.generate.py howtofit); only tutorials 4, 6 and 7 changed.generate_markdown.py howtofit --only tutorial_4), PASS in 527s; backtick fix confirmed present, unbackticked form absent, siximages/references intact, zero/home/jammyleaks.git statuswithout the.gitignoreexception).Smoke CI impact of the added NUTS fit is minimal:
config/build/profile_smoke.yamlruns atPYAUTO_TEST_MODE=2(sampler skipped), and tutorial 7 already carries aPYAUTO_DISABLE_JAX: "0"override. The threesamples_info.get(...)lines already ran in tutorial 6 under this identical profile.Independent of PyAutoLabs/PyAutoNerves#166; no library-first gate applies.
Closes #61
🤖 Generated with Claude Code
https://claude.ai/code/session_011DMhAYrJ6m2spkTVEWcSKg