Repository navigation
perf(ep): EP factor searches skip per-search visuals by default (#1642, PR 2 of 3) - #1644
Merged
Merged
Conversation
New config key `general.yaml -> output -> visualize_ep_factor_searches` (default false). Under expectation propagation, `NonLinearSearch.optimise` now turns off each factor search's per-search visuals (analysis.visualize / visualize_combined and plot_results) and draws before-fit visuals only on the first search of each factor. Samples, summaries and the EP optimiser's own output (graph.info, graph.png, ep_history.csv) are unchanged. Set the key true to restore the previous behaviour. - NonLinearSearch: class-level `_visualize_fit` / `_visualize_before_fit` switches, set around `self.fit` in `optimise` and reset in `finally`; `pre_fit_output` gates before-fit visuals on them. - SearchUpdater: `visualization_enabled` flag; `visualize()` is a no-op when False. `_updater` propagates `_visualize_fit` on every access. - The key is read with `.get(..., False)` so user configs that predate it keep working. Users lose per-factor model_fit/corner images by default under EP (intended). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
PR 2 of 3 under #1642, stacked on #1643 (base =
feature/ep-factor-search-overhead). Retarget tomainafter #1643 merges. PR 3 (mapper fast path) follows.EP re-enters the same factor search once per EP step. At small per-factor fits the per-search plotting dominated the wall time, and the images were overwritten on every step anyway. This PR switches it off by default:
general.yaml -> output -> visualize_ep_factor_searches: false. It is read with.get(..., False), so user configs that predate the key keep working.NonLinearSearch._visualize_fit/_visualize_before_fitare class attributes (defaultTrue).optimise(the EP entry point) sets them aroundself.fit(...)and resets both toTruein afinally.pre_fit_outputgatesanalysis.visualize_before_fiton_visualize_before_fit, so only the first search of each factor (number == 0) draws before-fit visuals.SearchUpdater(visualization_enabled=True): when False,visualizereturns immediately (noanalysis.visualize/visualize_combined/plot_results, no samples loaded for plotting). The cached_updaterre-appliesself._visualize_fiton every access.Samples, summaries and the EP optimiser's own
graph.info/graph.png/graph_factors.png/mean_field_evolution.png/ep_history.csvare unchanged.Harness:
n5_profile, repeat 0, max_steps 3, nlive 100, seeded. The machine was shared with another profiling job (load average ~6), so the PR 1 head was re-run interleaved as a load-matched control.run_nestedcalls (15 factor searches)ep_historyflagsdataset_*/optimization_*optimization_0/image/data.pngper factorFull evidence: #1642 (comment).
API Changes
No public signature is removed or changed incompatibly. One behaviour change and two additions:
output.visualize_ep_factor_searches: trueingeneral.yamlto restore the previous behaviour. The NSS live-visual path is untouched, and ordinarysearch.fit(outside EP) is unchanged.output.visualize_ep_factor_searches(defaultfalse).SearchUpdater(..., visualization_enabled: bool = True)and attributeSearchUpdater.visualization_enabled.See full details below.
Test Plan
test_autofit/graphical/test_ep_factor_search_visuals.py(3 tests, all red on PR 1 source):visualizeand 0plot_resultscalls and onevisualize_before_fitper factor;graph.info,graph.png,ep_history.csvpresent;true: every factor search draws per-search visuals;Trueafteroptimise.test_updater.py::test__visualize__disabled_skips_all.pytest test_autofit -p no:xdist): 2885 passed, 2 skipped.visualize_ep_factor_searches,visualization_enabled,_visualize_fit,_visualize_before_fithave no hits inautofit_workspace*, HowToFit, PyAutoArray, PyAutoGalaxy or PyAutoLens.Full API Changes (for automation & release notes)
Added
general.yaml -> output -> visualize_ep_factor_searches(defaultfalse).SearchUpdater.__init__(..., visualization_enabled: bool = True)and the public attributeSearchUpdater.visualization_enabled.NonLinearSearch._visualize_fit,NonLinearSearch._visualize_before_fit(private class attributes, defaultTrue).Changed Behaviour
NonLinearSearch.optimise(...)(EP factor search entry point): sets_visualize_fit = visualize_ep_factor_searchesand_visualize_before_fit = visualize_ep_factor_searches or number == 0aroundfit, resetting both toTruein afinally.NonLinearSearch.pre_fit_output:analysis.visualize_before_fitnow also requires_visualize_before_fit.SearchUpdater.visualize: returns immediately whenvisualization_enabledis False.NonLinearSearch._updater: re-applies_visualize_fitto the cached updater on every access.Migration
visualize_ep_factor_searches: trueunderoutput:in yourgeneral.yaml.Heart RED override (development only)
This PR is opened under the
PyAutoBrain/AUTONOMY.md"Human override for Heart RED (development only)". It is a development-shipping override only. It does not claim to fix Heart, and Heart remains RED for release purposes. Merge still needs a separate explicit human/prmwith every required check green.pyauto-heart readiness --json, verdict red, score 45, ts 2026-09-24T15:11:12.973142+00:00):release validation FAILED (stage integrate)workspace validation not passing (4 failed, cloud#35579888156: autolens notebooks/cluster/modeling.ipynb, autolens notebooks/weak/a2744.ipynb, autolens scripts/cluster/modeling.py, +1 more)manifest drift: hub organism blurb (organs present) — 7 mismatch(es) vs PyAutoMind/repos.yamltest_autofit2885 passed / 2 skipped on head 1cd4a5b; the new EP-visuals tests are red on PR 1 source; EP harness moments bit-identical to PR 1; downstream workspace impact (iii) none.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EQdWrHM9BUx1q2zZRy6Y7N