feat(graphical): EP diagnostics and monitoring tooling#1349
Merged
Conversation
EP framework review Phase 4 — built-in tools for analysing a finished EP fit and monitoring a running one: - expectation_propagation/diagnostics.py (new): EPDiagnostics collector (per-factor-update snapshot: status, global log-evidence, KL step, every variable's mean/std); live-overwritten ep_history.csv + mean_field_history.csv; mean_field_evolution.png; post-fit mean_field_summary() table; check_sigma_collapse() F10 guard (floor + monotone-shrink detection) - optimiser.py: EPOptimiser/ParallelEPOptimiser snapshot each update, emit artifacts at output_interval + run end; F3 fixed (parallel end-of-run visualiser()/_output_results guarded for paths=None) - visualise.py: graph_factors.png per-factor evidence/KL curves (replaces dead commented-out code) - exports: EPDiagnostics, mean_field_summary, check_sigma_collapse from autofit.graphical (additive) - test_diagnostics.py: 7 tests (snapshot schema, artifacts, summary, collapse detector, F3 guards) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EP framework review Phase 4 (tracker #1335; ship approved by human 2026-07-10). Built-in tools for analysing a finished EP fit and monitoring a running one: an
EPDiagnosticscollector snapshotting every factor update (status, global log-evidence, KL step, per-variable mean/std), live-overwrittenep_history.csv/mean_field_history.csvso a running fit can be watched,mean_field_evolution.png, a post-fitmean_field_summary()table, a per-factorgraph_factors.png(replacing dead commented-out code, so one misbehaving factor is visible instead of averaged away), andcheck_sigma_collapse()— the runtime guard for audit finding F10 (undamped Laplace-only EP collapses sigmas to ~1e-15 with no guardrail). Also fixes F3 from #1332: the parallel optimiser's end-of-runvisualiser()/_output_resultscrash whenpaths=None.All additive; no behaviour change to fitting. Branch merged with current
main(post #1345/#1348/#1334) before validation.API Changes
Additive only. Three new public exports from
autofit.graphical:EPDiagnostics,mean_field_summary,check_sigma_collapse.EPOptimiser/ParallelEPOptimisernow emit diagnostics artifacts atoutput_intervaland run end (F3 crash fixed on the parallel path).See full details below.
Test Plan
test_autofit/suite on the merged branch: 1457 passed / 14 skipped (current-main baseline 1447 + 7 new diagnostics tests + 3 docs seam tests)test_diagnostics.py— 7 tests: snapshot schema, CSV/plot/results artifacts, summary content, collapse detector (floor + monotone + healthy-negative), F3 guardsmean_field_summary()calls into the Phase-3 EP walkthrough example (autofit_workspace#82)Validation checklist (--auto run — plan on the issue)
Full API Changes (for automation & release notes)
Added
autofit.graphical.EPDiagnostics— per-factor-update snapshot collector; writesep_history.csv,mean_field_history.csv(live-overwritten),mean_field_evolution.png,ep_diagnostics.resultsautofit.graphical.mean_field_summary(...)— post-fit per-variable summary tableautofit.graphical.check_sigma_collapse(...)— F10 guard: absolute-floor + monotone-shrink detection over the update history; warnings logged and written to the results filegraph_factors.png— per-factor evidence/KL curves emitted by the EP visualiserChanged Behaviour
EPOptimiser/ParallelEPOptimiser— snapshot each factor update and emit the diagnostics artifacts atoutput_intervaland run end (additive output; fitting unchanged)ParallelEPOptimiser— end-of-runvisualiser()/_output_resultsno longer crash whenpaths=None(F3, research: EP review phase 1 — statistics audit of autofit/graphical #1332)Migration
🤖 Generated with Claude Code