Skip to content

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

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).
  • F4AbstractMessage.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

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