Skip to content

fix(graphical): EP statistics fix batch — F1/F2/F4/F8 from #1332 #1350

Closed

Description

@Jammy2211

Overview

Executes the remainder of the #1332 audit's recommended fix batch, now that the #1331 decision hub is resolved and shipped (#1345, #1348) and F3/F10 (#1349), F5 (#1334), F7(c) (#1345) have landed. Prompt: PyAutoMind/bug/autofit/ep_statistics_fix_batch.md.

Plan

  • F1 / F7(a) — MeanField.__truediv__ / __pow__ pass log_norm into the plates ctor slot (evidence silently dropped; a float lands in _plates). Fix the ctor calls; fix __pow__'s meaningless log_norm * other.log_norm branch.
  • F2 (+extended) — GammaMessage.kl and BetaMessage.kl compute KL(other‖self) while Normal/TruncatedNormal compute KL(self‖other); EPHistory.kl_divergence sums per-variable KLs, so mixed graphs mix directions. Contract: self.kl(other) = KL(self‖other), documented once on AbstractMessage.kl, aligned family-wide, enforced with a numerical property test (sample-based KL estimate per family).
  • F4 — AbstractMessage.update_invalid scalar branch is self-flagged broken (the BAD_PROJECTION recovery path). Fix + test both branches.
  • F8 — delete dead/suspect quasi-Newton variants in laplace/newton.py (diag_sr1_bfgs_update → returns None; bfgs1_update sign-disputed vs exported bfgs_update; diag_sr1_update_ unused).

Out of scope (parked with notes on #1332): F6 truncated-KL moments, F7(b) factor-evidence recording design, F9 private scipy import.

Validation: full suite; new unit tests per fix; autofit_workspace_test/scripts/graphical/ep_{parity,deterministic,exact}.py as integration smoke.

Branch survey
Repository Current Branch Dirty?
./PyAutoFit main (post #1349) clean

Suggested branch: feature/ep-statistics-fix-batch. PyAutoFit claim-free (verified).

Autonomy: supervised (--auto chain, human directed "roll straight into the #1332 fix batch" 2026-07-10; heart-ack 6-reason set binds).

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Jul 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped at PR-open — #1351

    All four findings executed; one verdict flipped honestly: F4 is an exoneration, not a fix — the self-flagged scalar branch is empirically correct (messages iterate over parameters; all-or-nothing swap valid for ndim==0); the stale TODO is replaced and both branches pinned by tests.

    Gate: suite 1465/14 with one pre-existing failure (test_full_hierachical — fails on clean main with this batch fully stashed, bisect-proven ×3; filed as bug/autofit/hierarchical_ep_test_flaky.md — notably the #1349 diagnostics artifacts are the right instrument for it) · EP integration smoke 3/3 PASS · KL direction certified per-family by Monte Carlo · Heart YELLOW, identical 6-reason acked set.

    Out-of-scope reminders parked on #1332: F6 (truncated KL moments), F7(b) (factor-evidence recording design), F9 (private scipy import). Merge stays human.

  2. Jammy2211 commented on Jul 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Merged — c5c50cca via #1351 (merged-unchanged). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions