Skip to content

graphical: analytic_gaussian on the moments projection — un-park + smoke, seeded Dynesty column (PyAutoFit#1654 phase 2) - #105

Merged
Jammy2211 merged 4 commits into
mainfrom
feature/ep-moment-projection
Sep 30, 2026
Merged

Jammy2211 merged 4 commits into
mainfrom
feature/ep-moment-projection

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 of PyAutoFit#1654: the analytic Gaussian EP scripts now run the autofit EP column with af.LaplaceOptimiser(projection="moments") (the nested-quadrature projection added in PyAutoFit#1656). analytic_gaussian.py passes parity 41/41 on the moments path, so it is un-parked from no_run.yaml and added to the smoke gate. The joint DynestyStatic fit is now seeded, because unseeded runs flaked on the graphical column (2 of 6 smoke runs exited 1 with EP green). analytic_gaussian_priors.py stays parked with a re-dated reason: its loggaussian leg fails on a library Jacobian finding, filed as a Mind bug prompt.

Upstream PR

PyAutoLabs/PyAutoFit#1656 — merged 2026-09-30, unreleased. This PR is release-gated on PyAutoFit: the scripts use projection="moments", which exists only on PyAutoFit main.

Scripts Changed

  • scripts/graphical/analytic_autofit.py — run_autofit_ep(..., projection="moments") passes through to af.LaplaceOptimiser(projection=projection); adds SeededDynestyStatic (injects rstate into search_kwargs) and seeds random/numpy.random in run_joint_fit.
  • scripts/graphical/analytic_gaussian.py — labels "(Laplace)" → "(moments)"; __Status__ docstring and run numbers rewritten from the 2026-09-30 runs.
  • scripts/graphical/analytic_gaussian_priors.py — labels and docstring updated; still parked in no_run.yaml with a re-dated reason (loggaussian library finding).
  • scripts/graphical/analytic_gaussian_collapse.py — per-seed 0.5·std_ref scatter check, reported but not gating (SCATTER_CHECK_GATES = False); docstring explains the mode-path fallback.
  • config/build/no_run.yaml — un-park analytic_gaussian.py; re-date the priors park reason.
  • smoke_tests.txt — add graphical/analytic_gaussian.py after the collapse script.

Results

Real runs at seed 0 unless stated.

analytic_gaussian.py — PARITY: PASS (41/41)

Leg Result Detail
A 18/18 autofit EP a = b = 0.000 on every row; HierarchicalFactor SUCCESS=14
B 23/23 EP sigma 6.3401 ± 2.4609 vs closed form 6.5667 ± 2.8832 (a 0.079, b 0.146); mu a 0.021, b 0.061; x_i a ≤ 0.018, b ≤ 0.010; HierarchicalFactor SUCCESS=25, no BAD_PROJECTION/FAILURE

After seeding, 3 smoke-profile runs (96 / 130 / 104 s) gave byte-identical tables.

analytic_gaussian_priors.py — PARITY: FAIL (43/48), stays parked

Prior Result Detail
gaussian 16/16 sigma 6.3079 ± 2.5678 (a 0.090, b 0.109)
truncated 16/16 sigma 6.3401 ± 2.4609 (a 0.079, b 0.146)
loggaussian 11/16 log sigma 3.2832 ± 0.7413 vs 1.8338 ± 0.3608 (a 4.017, b 1.054); E[sigma] 35.09 outside [3.54, 11.59]; PriorFactor FAILURE=3

The minimal EP referee passes on loggaussian (1.8164 ± 0.3716). The diagnosis is two Jacobian inconsistencies in the library:

  1. _OuterAxis.to_physical adds log|dx/du| to a cavity that is already a base-space density.
  2. PriorFactor uses a physical density against a base-space cavity.

Fixing both in a scratch monkeypatch recovers 1.8161 ± 0.3716. The follow-up is filed as the Mind bug prompt draft/bug/autofit/ep_moments_loggaussian_transformed_scatter.md.

analytic_gaussian_collapse.py — COLLAPSE CONFIG: PASS (5/5)

seed EP sigma closed form scatter pull class
0 9.29 ± 3.53 6.57 ± 2.88 0.945 (miss) RECOVER
1 10.74 ± 3.20 10.46 0.094 RECOVER
2 13.35 ± 2.92 13.57 0.076 RECOVER
3 13.88 ± 2.88 14.35 0.159 RECOVER
4 12.21 ± 3.03 12.48 0.089 RECOVER

The scatter check passes on 4/5 seeds and is non-gating. Seed 0 misses because its hierarchical factors fall back to the mode path: three finite-limit outer variables exceed moment_max_outer=2. That library change is the second item of the same Mind prompt.

Smoke

  • Full suite: 15/15 in 177 s. analytic_gaussian.py took 129.5 s against the 300 s cap.
  • After the rebase onto origin/main, analytic_gaussian.py alone passed in 119.0 s under the smoke profile.

Test Plan

  • Full smoke suite (run_smoke.py runner, profile_smoke.yaml) passes 15/15 on this branch (177 s)
  • graphical/analytic_gaussian.py re-run under the smoke profile after the rebase: PASS, 119.0 s (cap 300 s)
  • Real runs of all three analytic Gaussian scripts (tables above)
  • CI smoke gate green (Python 3.12 / 3.13)
  • PyAutoFit release carrying #1656 before merge (release gate)

Heart RED override (development only)

  • Authorised by the live human in the Claude Code session at 2026-09-30 ~16:05 BST. Question: "Push + open the pending-release PR on autofit_workspace_test under the RED override (four sinks recorded); merge stays yours via /prm and waits on the library-first + release gates." Answer: "Override: open the workspace PR (Recommended)".
  • Exact RED reason (readiness --json, ts 2026-09-30T12:42:09Z): "release validation FAILED (stage integrate)". Yellow: "workspace validation not passing (0 failed, 1 timeout, cloud#36404726969: autolens_test scripts/multi_dataset/rectangular.py)"; "manifest drift: public front-door organ tables (generated) — 1 mismatch(es) vs PyAutoMind/repos.yaml". Freeze: expired (clear).
  • Branch gates passed: rebase on origin/main clean; smoke 15/15 (177 s); single-script re-run after the rebase PASS (119.0 s); real runs as above.
  • This PR does not claim to fix Heart. Heart stays RED for release purposes.
  • Merge needs its own human command (/prm) and green required checks. It also needs library-first, which is met (#1656 merged), and the PyAutoFit release gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Up1fQmjtGAh4RhLrWHfcfg

Jammy2211 and others added 4 commits September 30, 2026 15:36
… (#1654)

run_autofit_ep takes projection= (default "moments") and passes
af.LaplaceOptimiser(projection=projection); the "autofit EP (Laplace)"
labels become "(moments)". analytic_gaussian_collapse.py reports a per-seed
"scatter within 0.5 std_ref of the closed form" check (SCATTER_CHECK_GATES,
reported but not yet gating).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Up1fQmjtGAh4RhLrWHfcfg
…ments runs (#1654)

analytic_gaussian.py PARITY PASS 41/41; analytic_gaussian_priors.py 43/48
(gaussian/truncated 16/16, loggaussian 11/16, filed as a Mind bug);
analytic_gaussian_collapse.py 5/5 with the scatter check 4/5 (hierarchical
factors fall back to the mode path: 3 bounded outer variables).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Up1fQmjtGAh4RhLrWHfcfg
…priors park (#1654)

analytic_gaussian.py comes off no_run.yaml and joins smoke_tests.txt after
the collapse script (84-119 s locally under the smoke profile, 300 s cap).
analytic_gaussian_priors.py stays parked with its 2026-09-30 reason: the
loggaussian family misses 11/16 under the moments projection.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Up1fQmjtGAh4RhLrWHfcfg
Unseeded, the graphical column's leg-B sigma cell passed or failed on
sampler noise (2 of 6 smoke-profile runs exited 1; a 0.111 against 0.10)
with the EP column green each time. SeededDynestyStatic passes a seeded
dynesty rstate, and run_joint_fit seeds random/numpy.random for the
initializer. Three repeated runs now print identical tables, 41/41 PASS.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Up1fQmjtGAh4RhLrWHfcfg
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 30, 2026
@Jammy2211
Jammy2211 merged commit 8f6e19c into main Sep 30, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/ep-moment-projection branch September 30, 2026 15:11
@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