Skip to content

Add model_information: held-out lower bound on I(M;Y) from posterior model probabilities (#238) - #239

Merged
jc-macdonald merged 2 commits into
mainfrom
feat/model-information-238
Nov 6, 2026
Merged

jc-macdonald merged 2 commits into
mainfrom
feat/model-information-238

Conversation

@jc-macdonald

Copy link
Copy Markdown
Collaborator

Closes #238.

What

trade_study.information: model_information, ModelInformation, TruthScore. From the posterior model probabilities that any reader assigns on held-out replicates it returns a lower bound on the mutual information I(M; Y) between the generating structure and the data:

I(M; Y) >= H(M) + E[log q(M | Y)], the gap being E_Y KL(p(M | Y) || q(M | Y)) >= 0.

The estimator is stratified by structure, H(pi) + sum_m pi_m * mean_{i: truth_i = m} log q_i(m), so the number of replicates per structure may differ from the prior; its standard error is sqrt(sum_m pi_m^2 s_m^2 / n_m) with a normal-approximation interval (stdlib NormalDist, no new dependency). Also returned: H(M), the fraction of prior entropy resolved, and per-structure mean log score and mean probability of the truth.

Scientific conditions (in the docstring and docs/api/information.md)

  • Valid only for posteriors of replicates the reader was not fitted on; otherwise optimistic.
  • Any reader gives a lower bound; miscalibration lowers it and cannot raise it above I(M; Y).
  • Independent replicates drawn with the declared prior frequencies; at least two per structure with positive prior; a replicate of a zero-prior structure is refused.
  • Failed trials are never dropped: all-NaN rows raise unless failed="prior", which replaces the row by the prior (zero information). A partly missing row is refused.
  • A probability for the truth below floor is raised to it and counted in n_floored; this is optimistic (a zero would give -inf), so any count is a warning.
  • A statement about the simulated generating structures, not about real data when none of them generated it.

Validation

  • Closed forms: flat reader gives 0, certain-and-right reader gives H(M) (one bit for two equal structures).
  • Two-structure Gaussian location problem (Y | A ~ N(-mu, 1), Y | B ~ N(+mu, 1)) where the exact posterior is a sigmoid and I(M; Y) is computed by quadrature: with the exact posterior the estimate is within 4 standard errors of the quadrature value (balanced and 3:1 unbalanced replicates); tempered readers (0.3 and 3.0) give intervals entirely below it.
  • Failed-row handling, per-truth scores, prior weighting, interval widening with confidence, 14 refused-input cases.
  • just ci passes locally: lint, mypy --strict, 1141 tests, coverage 94.9%.

Not in this PR

Reliability of the model posterior, a nested Monte Carlo EIG estimator, Bayes-factor design analysis and the link to #217 are listed in #238 as later phases.

… model probabilities

A stratified estimate of H(M) + E[log q(M | Y)] over independent replicates,
with a normal-approximation interval, per-structure scores, failed replicates
kept (failed='prior' counts them as zero information), and the probability
floor reported. Closes #238.
@jc-macdonald

Copy link
Copy Markdown
Collaborator Author

Independent review (read-only agent): approve with edits. Edits applied in the last commit (all-failed-stratum note in the docstring and docs, edge-case tests for an all-failed stratum, a one-hot prior, float32 input and a 1-D posterior; calibration wording). CI green on all jobs. Merging.

@jc-macdonald
jc-macdonald merged commit 669516c into main Nov 6, 2026
11 checks passed
@jc-macdonald
jc-macdonald deleted the feat/model-information-238 branch November 6, 2026 19:21
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.

Model-discrimination information: held-out lower bound on I(M;Y) from posterior model probabilities

1 participant