Skip to content

Add information_curve and minimum_adequate_information (#240) - #241

Merged
jc-macdonald merged 1 commit into
mainfrom
feat/information-curve-240
Nov 9, 2026
Merged

jc-macdonald merged 1 commit into
mainfrom
feat/information-curve-240

Conversation

@jc-macdonald

Copy link
Copy Markdown
Collaborator

Closes #240. Builds on #238 / #239 (merged).

What

  • information_curve(results, log_score, truth, along, labels, *, prior, confidence, adjustment): from raw replicate rows (one held-out replicate per row; truth a configuration factor, log_score the observable log q(truth | y)), groups by the other factors and by the ordered size along and returns, per stratum, the stratified bound of model_information at every size with its interval (optionally Bonferroni across the scanned sizes), in nats, with per-structure counts. InformationCurve, InformationPoint.
  • minimum_adequate_information(curves, target, *, rule="lower_bound" | "estimate", fraction=False): the smallest size that reaches target nats (or a fraction of H(M)), with monotone_above as in AdequateDesign. AdequateInformation.
  • The estimator is shared with model_information (_stratified; mean_probability is nan when only log scores are supplied).

Conditions (docstrings and docs/api/information.md)

Those of model_information per size, plus: scores must be finite and at most 0 (a failed replicate is scored by the caller, for example with the log of the prior probability of its structure, never dropped); the probability floor is the caller's responsibility; the lower end of a marginal interval holds at the selected size only, and monotone_above reports a curve that dips after the selection; a selected size is a statement about the simulated structures and the grid, to be confirmed with fresh replicates.

Validation

  • An exactly known curve: cohorts of n iid N(+-mu, 1) draws with the exact reader on their sum, for which I(M; Y) at size n equals the one-observation information at mu * sqrt(n) (quadrature). The curve is within 4 standard errors of the exact value at sizes 1, 4, 16 and 64 with 40,000 replicates per structure, and increasing.
  • The smallest size reaching 0.2 nats by the estimate rule equals the exact smallest size; the lower-bound rule picks the same or a larger size and its selected lower end reaches the target.
  • A point equals model_information on the same replicates; strata are separate curves; Bonferroni widens; a non-monotone curve is flagged; unreachable targets give None; 10 refused-input cases plus unorderable sizes and invalid arguments.
  • Local: lint, mypy --strict, strict docs build, doctests and the information tests; the full suite runs in CI.

The stratified held-out bound of model_information per design size from
replicate rows of log q(truth | y), with optional Bonferroni intervals, the
smallest size reaching a target in nats or as a fraction of H(M), and a
monotone_above flag.
@jc-macdonald

Copy link
Copy Markdown
Collaborator Author

Independent review (read-only agent): approve, no edits requested. CI green on all jobs. Merging with the owner's admin override as authorised.

@jc-macdonald
jc-macdonald merged commit 5a847ec into main Nov 9, 2026
11 checks passed
@jc-macdonald
jc-macdonald deleted the feat/information-curve-240 branch November 9, 2026 14:01
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.

Information curves and minimum adequate design size for model discrimination

1 participant