From f02d0169cbe95d149923d31a5023f9d2c4039451 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Thu, 8 Oct 2026 08:39:24 +0100 Subject: [PATCH] docs: refresh the search roster and drop stale config claims - skills/af_configure_search.md: roster gains NSS, SMC, BFGS and MultiStartAdam/ADABelief/Lion/Prodigy, with a note on which need use_jax=True; drop "until the core wiki lands" (it has); replace the per-search YAML claim (removed in PyAutoFit #1202) with constructor kwargs; point students at HowToFit chapter_1_introduction/tutorial_3_non_linear_search (there is no chapter 2). - wiki/core/concepts/non_linear_search.md, wiki/core/stack/autonerves.md: same YAML correction; content_sha256 restamped (the claim was already false at both pinned commits, so the pins stand). - config/non_linear/README.md: names PyAutoFit, lists only GridSearch.yaml. Refs PyAutoLabs/PyAutoFit#1668 Co-Authored-By: Claude Fable 5.1 --- config/non_linear/README.md | 11 +++++--- skills/af_configure_search.md | 37 +++++++++++++++++-------- wiki/core/concepts/non_linear_search.md | 8 +++--- wiki/core/stack/autonerves.md | 13 +++++---- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/config/non_linear/README.md b/config/non_linear/README.md index f69c3b3..b60f7f6 100644 --- a/config/non_linear/README.md +++ b/config/non_linear/README.md @@ -1,8 +1,11 @@ The `non_linear` folder contains configuration files which customize the default behaviour of non-linear searches in -**PyAutoLens**. +**PyAutoFit**. + +The default settings of each individual search (e.g. `Nautilus`, `Emcee`, `LBFGS`) are not set by configuration files. +They are the default values of the arguments of each search class's constructor, and are changed by passing those +arguments when the search is created. # Files -- `mcmc.yaml`: Settings default behaviour of MCMC non-linear searches (e.g. Emcee). -- `nest.yaml`: Settings default behaviour of nested sampler non-linear searches (e.g. Dynesty). -- `mle.yaml`: Settings default behaviour of maximum likelihood estimator (mle) searches (e.g. LBFGS). +- `GridSearch.yaml`: Settings default behaviour of a parallelized grid search of non-linear searches (e.g. the + number of cores and the default step size). diff --git a/skills/af_configure_search.md b/skills/af_configure_search.md index ef64bea..59d116a 100644 --- a/skills/af_configure_search.md +++ b/skills/af_configure_search.md @@ -1,6 +1,6 @@ --- name: af_configure_search -description: Choose and configure a PyAutoFit non-linear search — nested samplers (Nautilus, DynestyStatic/Dynamic), MCMC (Emcee, Zeus, BlackJAXNUTS), and MLE optimizers (LBFGS, Drawer) — including output paths, cores, initializers and per-sampler settings. Use when the user asks "which sampler should I use", "configure the search", or wants to tune convergence/runtime. Not for actually executing the fit (that is `af_run_search`) or for composing the model (that is `af_compose_model`). +description: Choose and configure a PyAutoFit non-linear search — nested samplers (Nautilus, DynestyStatic/Dynamic, NSS), MCMC (Emcee, Zeus, BlackJAXNUTS, SMC), and MLE optimizers (LBFGS, BFGS, MultiStartAdam/ADABelief/Lion/Prodigy, Drawer) — including output paths, cores, initializers and per-sampler settings. Use when the user asks "which sampler should I use", "configure the search", or wants to tune convergence/runtime. Not for actually executing the fit (that is `af_run_search`) or for composing the model (that is `af_compose_model`). user-invocable: true --- @@ -18,12 +18,14 @@ distribution. Every search class shares the same construction pattern: a `name`/`path_prefix` that decides where output lands, `number_of_cores` for parallelisation, and per-sampler settings (`PyAutoFit:autofit/non_linear/search/`). The installed roster (verify with -`dir(af)` — never from memory): `Nautilus`, `DynestyStatic`, `DynestyDynamic` (nested); -`Emcee`, `Zeus`, `BlackJAXNUTS` (MCMC); `LBFGS`, `Drawer` (MLE). +`dir(af)` — never from memory): `Nautilus`, `DynestyStatic`, `DynestyDynamic`, `NSS` +(nested); `Emcee`, `Zeus`, `BlackJAXNUTS`, `SMC` (MCMC); `LBFGS`, `BFGS`, +`MultiStartAdam`, `MultiStartADABelief`, `MultiStartLion`, `MultiStartProdigy`, `Drawer` +(MLE). `NSS`, `BlackJAXNUTS`, `SMC` and the `MultiStart*` searches are JAX-native and +need an analysis built with `use_jax=True`. -Read `wiki/core/concepts/non_linear_search.md` for the decision guide (until the core -wiki lands, the canonical references are `autofit_workspace:scripts/searches/nest.py`, -`mcmc.py`, `mle.py`). +Read `wiki/core/concepts/non_linear_search.md` for the decision guide; the worked +examples are `autofit_workspace:scripts/searches/nest.py`, `mcmc.py`, `mle.py`. ## Ask @@ -55,7 +57,9 @@ search = af.Nautilus( ``` `af.DynestyStatic(nlive=50, ...)` / `af.DynestyDynamic(...)` are the alternative nested -samplers — long-standing, well-understood defaults with extensive literature. +samplers — long-standing, well-understood defaults with extensive literature. `af.NSS` +(nested slice sampling via BlackJAX) runs the whole sampler inside `jax.jit` and needs a +JAX-traceable likelihood. ## Branch — MCMC (posterior only) @@ -76,7 +80,9 @@ search = af.Emcee( ``` `af.Zeus` (slice-sampling ensemble) often mixes faster on correlated posteriors; -`af.BlackJAXNUTS` is the gradient-based option when the likelihood is JAX-differentiable. +`af.BlackJAXNUTS` is the gradient-based option when the likelihood is JAX-differentiable; +`af.SMC` (BlackJAX adaptive tempered SMC with a gradient kernel) also returns the log +evidence. Convergence is governed by auto-correlation settings (`af.AutoCorrelationsSettings`) — see `autofit_workspace:scripts/searches/mcmc.py`. @@ -93,6 +99,11 @@ answer of a Bayesian analysis (`PyAutoFit:autofit/non_linear/search/mle/`). search = af.LBFGS(name="gaussian_fit_lbfgs") ``` +`af.BFGS` is the full-memory scipy variant. `af.MultiStartAdam` / `MultiStartADABelief` / +`MultiStartLion` / `MultiStartProdigy` run many starts in parallel with JAX gradients +(`use_jax=True` required) and return the best basin — the better choice when the +likelihood is multi-modal or a single start gets stuck. + ## Output discipline `path_prefix` + `name` (+ `unique_tag`) map to `output////…`. @@ -100,9 +111,10 @@ Keep them stable across re-runs of the same fit — PyAutoFit resumes a complete from its output rather than re-running it, which is exactly what you want and worth telling the user before they wonder why a second run finishes instantly. -Per-sampler defaults live in `config/non_linear/` — a project can retune a sampler -globally there instead of repeating kwargs in every script -(`PyAutoNerves:autonerves/conf.py`). +A search's defaults are the keyword defaults of its class +(`PyAutoFit:autofit/non_linear/search/`); there are no per-search YAML files, so a +non-default setting is passed as a kwarg. `config/non_linear/` holds only +`GridSearch.yaml`. ## Combine @@ -114,7 +126,8 @@ globally there instead of repeating kwargs in every script ## Further reading -- **Student / new to inference** — HowToFit chapter 2: what a non-linear search is. +- **Student / new to inference** — `HowToFit:scripts/chapter_1_introduction/tutorial_3_non_linear_search.py`: + what a non-linear search is. - **General reference** — [RTD: search cookbook](https://pyautofit.readthedocs.io/en/latest/cookbooks/search.html). - **Experienced PyAutoFit user** — `autofit_workspace:scripts/searches/` (`nest.py`, `mcmc.py`, `mle.py`, `start_point.py`). diff --git a/wiki/core/concepts/non_linear_search.md b/wiki/core/concepts/non_linear_search.md index 571d845..0f9f66f 100644 --- a/wiki/core/concepts/non_linear_search.md +++ b/wiki/core/concepts/non_linear_search.md @@ -6,7 +6,7 @@ sources: - autofit/non_linear/search/ pinned_commit: 4592990b14cacab243cde9c17789d463ff4a674f last_updated: 2026-07-10 -content_sha256: b6e938919e7b4ce44ca05f18908290d0653ca37a296a579fdd109b07dc446ed7 +content_sha256: 7d5ab270e029c8b829bac65f8918a8e397ba867c30f50723add04ef52314e0ca --- # Non-linear searches @@ -53,9 +53,9 @@ local consumer refines — [[initialization_and_chaining]]. Every search takes `name` / `path_prefix` / `unique_tag` (output identity — a completed search **reloads instead of re-running**), `number_of_cores` -(parallelisation), and an `initializer` where the family supports it. Per-sampler -defaults live in `config/non_linear/*.yaml`, so a project can retune once rather than -in every script. Execution: `search.fit(model=model, analysis=analysis)` → `Result` +(parallelisation), and an `initializer` where the family supports it. Each search's +defaults are the keyword defaults of its class — there are no per-search YAML files, so +a non-default setting is passed as a kwarg. Execution: `search.fit(model=model, analysis=analysis)` → `Result` (`PyAutoFit:autofit/non_linear/search/abstract_search.py`). ## See also diff --git a/wiki/core/stack/autonerves.md b/wiki/core/stack/autonerves.md index cafbb6d..144df6a 100644 --- a/wiki/core/stack/autonerves.md +++ b/wiki/core/stack/autonerves.md @@ -6,7 +6,7 @@ sources: - autonerves/ pinned_commit: 89c4714449797b0c049e8a95d16d499c863f4811 last_updated: 2026-07-10 -content_sha256: e4eb6576a6ba6399d37707342188663758a0d224ae3c2a20bfd0952641a47c71 +content_sha256: 72fb17423e00b996f512f3799ee4d7a35cee3280760ce0f0c490386db51cb4e6 --- # PyAutoNerves (`autonerves`) @@ -15,11 +15,12 @@ The configuration layer under the whole PyAuto family. For an autofit user it matters in three places: 1. **Config trees.** The workspace's `config/` directory is an autonerves config tree: - `general.yaml`, `logging.yaml`, `output.yaml`, `non_linear/*.yaml` (per-search - defaults), `priors/*.yaml`, `visualize/*.yaml`. Values resolve **workspace-first**: - a key present in the project's `config/` overrides the library default — which is - how a project retunes a sampler or an output policy once, globally - (`PyAutoNerves:autonerves/conf.py`). + `general.yaml`, `logging.yaml`, `output.yaml`, `non_linear/GridSearch.yaml`, + `priors/*.yaml`, `visualize/*.yaml`. Values resolve **workspace-first**: a key + present in the project's `config/` overrides the library default — which is how a + project retunes an output or visualization policy once, globally + (`PyAutoNerves:autonerves/conf.py`). Individual searches are not configured here: + their defaults are the keyword defaults of each search class. 2. **Default priors by class.** `config/priors/.yaml` (or module-level files) supply priors for model classes so scripts need not repeat them — the right home for a project's standard parametrisation. Note: autonerves lowercases YAML dict