Skip to content

docs: add BlackJAXNUTS section to searches/mcmc.py - #52

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/blackjax-nuts-search
May 6, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/blackjax-nuts-search

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

  • Extends scripts/searches/mcmc.py with a worked example of af.BlackJAXNUTS — BlackJAX's No-U-Turn Sampler, shipped in PyAutoFit #1256.
  • Builds a separate analysis_jax constructed with use_jax=True so the existing Emcee / Zeus tutorial paths stay on NumPy. Calls enable_pytrees() + register_model(model) (same mechanism the Nautilus_jax example uses) so model.instance_from_vector JIT-traces.
  • Adds a follow-up block that prints the NUTS-specific samples_info diagnostics (ess_min, mean_acceptance, n_divergent, n_logl_evals) with prose explaining what each one means and when a non-zero divergence count should make the user re-run with a tighter target_accept.
  • Updates the docstring __Contents__ index to include the new section.

Library counterpart: PyAutoLabs/PyAutoFit#1256 (merged).
Issue: PyAutoLabs/PyAutoFit#1255.

Test plan

  • python scripts/searches/mcmc.py — runs Emcee, Zeus, and BlackJAXNUTS end-to-end without error. BlackJAXNUTS recovers (centre, normalization, sigma) close to (50, 25, 10), ESS comfortably above 100, 0 divergences.

🤖 Generated with Claude Code

Extends the MCMC tutorial with a worked example of `af.BlackJAXNUTS`
(BlackJAX gradient-based No-U-Turn Sampler), shipped in PyAutoFit
#1256. Builds a separate `analysis_jax` with `use_jax=True` so the
existing Emcee/Zeus path stays NumPy. Calls `enable_pytrees()` and
`register_model(model)` from `autofit.jax.pytrees` (the same
mechanism used by the `Nautilus_jax` example) so
`model.instance_from_vector` JIT-traces.

Also prints the NUTS-specific `samples_info` diagnostics
(`ess_min`, `mean_acceptance`, `n_divergent`, `n_logl_evals`) and
explains what each means / when to act on them.

Refs PyAutoLabs/PyAutoFit#1255

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 6, 2026
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Companion: PyAutoLabs/autofit_workspace_test#23

@Jammy2211
Jammy2211 merged commit e435943 into main May 6, 2026
1 of 5 checks passed
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
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