Skip to content

fix(submodel): statistical-model validators for the two-channel design - #74

Merged
jeliason merged 2 commits into
mainfrom
feat/submodel-stat-validators-0.8.1
Jul 23, 2026
Merged

fix(submodel): statistical-model validators for the two-channel design#74
jeliason merged 2 commits into
mainfrom
feat/submodel-stat-validators-0.8.1

Conversation

@jeliason

Copy link
Copy Markdown
Member

The 0.8.0 population-spread design has two channels — observation_code pins the CENTER (SEM-scale) and observed_distribution carries the population SPREAD (omega) — but the rules were only stated in the authoring prompt, so statistically-broken targets validated cleanly. This enforces them.

  • center-channel SEM-scale: a population observed_distribution now requires its observation_code to use sample_size (rejects double-encoding the spread).
  • bounded-observable shape: a percent/fraction/proportion/probability observable in the moments form must use shape: logit_normal, not normal/lognormal.
  • positive-crossing-zero: warns when an un-clipped observation_code pushes a positive-median quantity below zero (use multiplicative/lognormal); complements the existing clip warning, which only caught the clipped case.
  • adds ObservedDistribution.n_biological_is_floor for n>= counts, and teaches the authoring prompt the multiplicative-error rule, logit_normal-for-percent, do-not-double-encode, the 1.645 z-factor, and n_biological_is_floor.

Also folds in fix(extraction): attach native web search via capabilities=[NativeTool(WebSearchTool())] for pydantic-ai ≥2.x (bare capabilities=[WebSearchTool()] failed at run time, breaking lit-search).

jeliason added 2 commits July 23, 2026 15:56
…pydantic-ai 2.x

Post the pydantic-ai builtin->native rename (issue #5338), a native tool
attaches through capabilities= wrapped in a NativeTool capability. Bare
capabilities=[WebSearchTool()] failed at run time ("'WebSearchTool' object
is not callable"), breaking the lit-search stage of the extraction pipeline.
The 0.8.0 population-spread design has two channels: observation_code pins
the CENTER (SEM-scale), observed_distribution carries the population SPREAD
(omega). The rules were stated in the authoring prompt but not enforced, so
statistically-broken targets validated cleanly. Add validators:

- center-channel SEM-scale: a population observed_distribution requires its
  observation_code to use sample_size (rejects double-encoding the spread).
- bounded-observable shape: a percent/fraction/proportion/probability
  observable in the moments form must use shape=logit_normal.
- positive-crossing-zero: warn when an un-clipped observation_code pushes a
  positive-median quantity below zero (use multiplicative/lognormal error);
  complements the existing clip warning, which only caught the clipped case.

Add ObservedDistribution.n_biological_is_floor for 'n>=' unit counts so
precision-weighting consumers don't over-weight the panel. Teach the
authoring prompt the multiplicative-error rule, logit_normal-for-percent,
the do-not-double-encode rule, the 1.645 z-factor, and n_biological_is_floor.
@jeliason
jeliason merged commit 934c569 into main Jul 23, 2026
10 of 11 checks passed
@jeliason
jeliason deleted the feat/submodel-stat-validators-0.8.1 branch July 23, 2026 22:01
jeliason added a commit that referenced this pull request Jul 23, 2026
The 0.8.1 authoring prompt tells authors to use `1.645` (normal z for
the 5th–95th percentile range) when reconstructing an SD from box-plot
whiskers, but `ALLOWED_CONSTANTS` only whitelisted `1.96` (2.5th–97.5th)
— so a literal `1.645` failed
`validate_no_hardcoded_values_in_observation_code`. This adds `1.645`
alongside `1.96`, closing the prompt/validator inconsistency introduced
in #74.
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.

1 participant