Skip to content

feat(ep): report staleness per (factor, variable) and record reverted variables in ep_history.csv - #1576

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/ep-stale-tracking-per-variable
Sep 7, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/ep-stale-tracking-per-variable

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #1575. Follow-up to #1574 (umbrella #1405; graphical-ep epic, Codex phase-2 review finding 2, second half).

Problem

#1574 made a fully reverted projection count as skipped, so a factor that never moves is named by STALE FACTORS. A partial revert was still invisible: one variable reverted on every projection while the factor's other variables update. On the hierarchical graph that is the #1405 stale-scatter state — the scatter's reported posterior is the hyper-prior it started with while the factor counts as updated.

Change

  • Status.changed: the per-variable changed mask from MeanField.check_changed, computed on both branches of update_factor_mean_field (after update_invalid on the invalid branch) and threaded through every Status reconstruction. Not part of Status.__iter__, so the existing 4-tuple unpack is unchanged.
  • EPOptimiser accumulates seen / changed variables per factor name across sweeps (serial and parallel runs), so a decomposed factor's per-dataset members count as one group; _stale_factor_warnings names every (factor, variable) pair no member of the group ever moved, with the STALE FACTORS token so referee scripts keep matching.
  • ep_history.csv gains reverted_variables (;-joined names of the variables an update did not move; a fixed point lists every variable, so readers must test "on every row of a factor", not "on any row").
  • README STALE FACTORS paragraph updated.

API Changes

Status(changed=...) new optional keyword; ep_history.csv new trailing column (existing readers by name unaffected; test_diagnostics.py column lists updated).

Tests

  • New: partial revert names the stale variable, not the factor; reverted_variables recorded in ep_history.csv; Status.changed survives factor_step; group keying (one member moving the variable clears the group).
  • test_autofit/graphical 275 passed, test_autofit/messages 95 passed, full test_autofit/ 2469 passed / 2 skipped.
  • analytic_gaussian_collapse.py: RECOVER 5/5, BIASED-TIGHT 0/5, PATHOLOGICAL 0/5, STALE 0/5; inside [q05, q95] on 5/5 seeds — COLLAPSE CONFIG: PASS (5/5 seeds); no seed carries a per-variable line, because on every seed at least one member of the HierarchicalFactor group moved sigma (seed 0 has SUCCESS=1); ep_deterministic.py PASS.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gu4YysuvpQ4k6zkQjiwabd

…riables in ep_history.csv (#1575)

#1574 made a fully reverted projection count as skipped, so a factor that
never moves is named by STALE FACTORS. A partial revert — one variable
reverted on every projection while the factor's other variables update — was
still invisible, which is the #1405 stale-scatter state on the hierarchical
graph. update_factor_mean_field now computes the per-variable changed mask on
both branches and carries it on Status.changed; EPOptimiser accumulates seen /
changed variables per factor across sweeps (serial and parallel runs) and
_stale_factor_warnings names every (factor, variable) pair that never changed.
Pairs are keyed by factor name so a decomposed factor's per-dataset members
count as one group. ep_history.csv gains a reverted_variables column so the
workspace referee can read the signal.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gu4YysuvpQ4k6zkQjiwabd
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autofit_workspace_test#98 (merges after this one — library-first gate).

@Jammy2211
Jammy2211 merged commit 2680b32 into main Sep 7, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/ep-stale-tracking-per-variable branch September 7, 2026 22:44
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 26, 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.

feat(ep): report staleness per (factor, variable) and record reverted variables in ep_history.csv

1 participant