Skip to content

fix(graphical): EP statistics completion — F6 truncated KL + F7(b) evidence recording #1353

Description

@Jammy2211

Overview

The last two statistical legs from the #1332 audit, now that F1-F5/F7a/F7c/F8/F10 have landed (#1345/#1348/#1334/#1349/#1351):

  • F6TruncatedNormalMessage.kl uses the untruncated Gaussian formula; the error grows as posterior mass approaches the bounds. Live in HowToFit ch3 tutorial 5's EP convergence metric (af.TruncatedGaussianPrior). Fix: compute KL from truncated moments (mean/variance of the truncated normal via the standard hazard-function expressions), with the exact same-support case first and a documented approximation policy for mismatched supports.
  • F7(b)MeanField.from_priors (the projection behind every search-driven factor update) constructs with log_norm = 0, so the sampler's per-factor evidence never enters the mean field and EPMeanField.log_evidence cannot be trusted for model comparison in sampler-driven fits. Design decision + implementation: record the search's log-evidence in the projected mean field's log_norm (recommendation to be posted after code inspection; README §5 documents the intended evidence algebra).
  • Plus the README §6 sharpening from the research: EP review phase 5 — reconcile the three deterministic-variable mechanisms #1336 Recommendation-A adoption (decision recorded on research: EP review phase 5 — reconcile the three deterministic-variable mechanisms #1336, closed).

Validation: full suite; MC-vs-analytic KL tests for the truncated family (extending the #1351 direction property test); an evidence round-trip test (EP log_evidence vs analytic on the exact-conjugate toy); EP integration smoke (parity/deterministic/exact).

Autonomy: supervised (--auto chain, human directed 2026-07-10). Suggested branch feature/ep-statistics-completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions