Repository navigation
docs: HowToFit ch1 tutorials 6 gradients, 7 the details, optional Bayesian formalism - #50
Merged
Merged
Conversation
…yesian formalism Three new HowToFit chapter 1 tutorials: gradients (finite differencing, JAX autodiff, LBFGS vs MultiStartAdam, Emcee vs BlackJAXNUTS, Nautilus, errors from curvature), the details (label-switching degeneracy and assertions, plateaus, comparing searches, clipping and the resample figure of merit, value/gradient NaN diagnostics, unit cube vs physical) and an optional Bayesian formalism tutorial mapping tutorials 1-7 onto Bayes' theorem. The prose-only scientific-workflow tutorial is renumbered 6 -> 8. Chapter lists in README, start_here.py, llms.txt, markdown_examples.yaml and AGENTS.md are updated; profile_smoke.yaml keeps JAX enabled for the two gradient tutorials; notebooks and the navigator catalogue are regenerated. Closes #49 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014y2CwNSY8yBHwRpt8Mnqpv
…ches The navigator workflow's unbatched multi-start check requires every MultiStart* search to spell out batch_size; the three new call sites in tutorials 6 and 7 now pass batch_size=None with a comment saying why. Notebooks regenerated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014y2CwNSY8yBHwRpt8Mnqpv
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
Adds three chapter 1 tutorials to HowToFit and renumbers the prose-only scientific-workflow closer to tutorial 8. Closes #49.
Analysis(use_jax=True),jax.grad). Follows tutorial 3's MLE / MCMC / nested trio with gradient counterparts:LBFGSvsMultiStartAdam,EmceevsBlackJAXNUTS,Nautilus(gradient-free, vmap-accelerated). Closes with errors from curvature (jax.hessian, Laplace approximation) compared against the sampled errors of tutorial 5, plus a posterior-predictive overplot.gaussian_x2and its removal withadd_assertion(numpyFitExceptionvs tracedxp.wherepenalty explained); plateaus when a normalization goes to zero and three fixes; the same two problems run with nested sampling, MCMC and gradient descent, with the interpretation split into what the runs showed and what the mechanisms imply; unphysical parameter combinations producing NaN and the per-search resample figure of merit (-infMLE/MCMC,-1e99nested/SMC); theclipperargument;Value-NaNvsGradient-NaN Lane-Stepsinsearch.summarywith the double-wheretrap; unit cube vs physical space viavector_from_unit_vector.-0.5(χ² + noise norm), prior and the unit cube as its inverse CDF, posterior with a numericlog_prior + log_likelihood == log_posteriorcheck, MLE vs MAP, marginalization, evidence, gradients), stating up front that HowToFit deliberately teaches without the maths.All three run green with real sampling from the repo root (t6 ≈ 60 s, t7 ≈ 70 s, optional ≈ 15 s) and under the CI smoke profile. The chapter README,
start_here.py,llms.txt,markdown_examples.yaml,scripts/README.md,notebooks/README.mdandAGENTS.mdlist the new tutorials; notebooks and the navigator catalogue are regenerated.Scripts Changed
scripts/chapter_1_introduction/tutorial_6_gradients.py— newscripts/chapter_1_introduction/tutorial_7_the_details.py— newscripts/chapter_1_introduction/tutorial_optional_bayesian_formalism.py— newscripts/chapter_1_introduction/tutorial_6_scientific_workflow.py→tutorial_8_scientific_workflow.py— renamed, title renumbered (prose-only, still no code cells)scripts/chapter_1_introduction/start_here.py,scripts/chapter_1_introduction/README.md,scripts/README.md,notebooks/README.md,llms.txt,AGENTS.md— chapter 1 tutorial lists updatedconfig/build/profile_smoke.yaml—overrideskeep JAX enabled for tutorials 6 and 7 (their gradient searches refuseuse_jax=False);config/build/markdown_examples.yaml— new entries + renamenotebooks/chapter_1_introduction/*.ipynb,llms-full.txt,workspace_index.json— regeneratedTest Plan
python .github/scripts/run_smoke.pypasses for chapter 1 with the smoke profile (JAX overrides verified via the env resolver)check_tutorials_complete.pyandcheck_navigator.pypass;regenerate_navigator.pyleavesllms-full.txt/workspace_index.jsonunchangedNotes for review: tutorials 6 and 7 run long (917 and ~1,140 lines) — tutorial 7 covers seven distinct topics and its "Comparing Searches" section was rewritten to describe only what its short runs actually show. Installed-PyAutoFit findings surfaced while writing (assertion
repr()recursion, staleenable_pytrees()text,af.ex.Analysisbuiltinsum,Emceecrash with too few steps) are filed separately.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_014y2CwNSY8yBHwRpt8Mnqpv