Skip to content

Make held-out confirmation respect groups and test more comparisons - #152

Merged
jiaq-liu merged 4 commits into
mainfrom
holdout-confirmation
Nov 22, 2026
Merged

jiaq-liu merged 4 commits into
mainfrom
holdout-confirmation

Conversation

@xxlya

@xxlya xxlya commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Integrates the points from a review of an explore run on a table with several
rows per source item. Each point was checked against the code first.

Added

  • --group-col: keeps each group on one side of the held-out split and
    resamples whole groups for held-out intervals. Suggests a group column
    from the data when none is named.
  • Recipe designs: where, stratified, difference in differences, fixed-bin
    dose-response, and expect (including abs< for controls). Numeric
    outcomes are supported.
  • Hypotheses may carry host-checked numeric predictions and a four-field
    experiment plan.
  • Data card, leakage check, --time-col, --text-col keyword recipes.
  • Guide: docs/holdout_confirmation.md. Calibration:
    docs/validation/holdout_calibration_20261121.md.

Behaviour changes

  • All held-out claims share one BH family; in-sample two-group candidates
    are corrected too. Some verdicts that passed alone no longer do
    (examples/m2_m3/deco_hallu_explore/test_hypotheses.py gets stricter).
  • adjudication.method names the correction applied (none when empty).
  • The held-out judge follows --backend; --judge-model no longer defaults
    to a Claude model on other backends.
  • --max-rows truncation is reported; the temp sandbox is deleted after
    artifacts are written.
  • Three existing tests were changed to reflect the above.

Verification

  • Fast suite: 3214 passed, 1 failed (test_dynamic_api_filters_and_serves_spa,
    which fails the same way on main without the report UI bundle).
  • Calibration: with a no-effect flag that varies by group, 22.3% false
    positives treating rows as independent vs 7.5% with the group column
    (target 5%). Where the method misses, it misses on the permissive side.
  • Command-line smoke test on files on disk without a coding agent.

Not covered

  • Not yet run with a real coding agent or judge; wiring tests use stand-ins,
    and the explorer, hypothesis and judge prompts changed.
  • The dashboard does not render the new confirm_report.json fields.
  • Not built: external embeddings as input, an offline file backend.

xxlya and others added 4 commits November 21, 2026 10:13
…arison

A review of an explore run on a table with several rows per source item
found that the held-out check was weaker than it looked. This addresses the
points that held up against the code.

Rows that share a group
- split_records / _split_records take group_col and keep each group on one
  side. A row-level split left most held-out rows in groups the explorer had
  already seen.
- evalrx.stats.weighted_bootstrap resamples whole clusters for any statistic
  written over row weights. compare(paired=False) accepts
  cluster_by=(groups_a, groups_b); a flat sequence is still ignored there.
- A two_group sufficient statistic may carry clusters_a / clusters_b.
- The profile takes explicit group and time columns, recognises calendar
  names and ISO dates as time, suggests columns that look like a grouping
  unit (many values, repeats, high intraclass correlation) and flags
  columns that almost fully determine the outcome.

Held-out comparisons
- Recipes gain where, design (stratified with strata, did with a modifier,
  dose_response with fixed bins) and expect (>, <, abs< a bound, nonzero).
  abs< states a control: it holds only when the whole interval is inside
  the bound. A numeric outcome is compared by mean.
- Every claim, one per signal and one per hypothesis prediction, enters one
  Benjamini-Hochberg family. reject means the claim survived; raw_reject
  keeps the uncorrected verdict. In-sample two_group candidates get a
  p-value and a BH family too. adjudication.method names the correction
  applied and is "none" for an empty family.
- A binary two-group comparison with independent rows takes its p-value
  from the exact test: the bootstrap degenerates on small, cleanly
  separated samples.
- No recipe expression may read the outcome column, whatever its name.
- Signals whose claim holds list representative rows near each side's
  median.

Hypotheses
- A hypothesis may carry numeric predictions about named signals, which the
  host checks without a model, and a four-field experiment plan in place of
  free text.

Explore run
- --group-col, --time-col, --text-col (keyword recipes chosen on the
  exploration half and re-tested on the other), --data-card and its four
  flags, --judge-backend (default: the explorer's backend; the judge was
  fixed to the Claude CLI), --keep-sandbox.
- A load that drops rows at --max-rows says how many. The temporary sandbox,
  which holds a copy of the data, is deleted once artifacts are written.
- The report records whether the judge is the model that proposed the
  hypotheses.

Behaviour changes: held-out and in-sample two-group verdicts are now
corrected for multiplicity, so some that passed alone no longer do;
--judge-model no longer defaults to a Claude model on other backends;
compare(paired=False) reports "two-sample bootstrap (unpaired)" when no
clusters are given.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoBWQhSUCKmU2rGbRh5ALP
docs/holdout_confirmation.md explains the group column, the recipe designs,
stated expectations, the single correction family, host-checked predictions,
keyword recipes and the data card, and lists what the method cannot do.

tools/check_holdout_calibration.py simulates data with a known answer;
docs/validation/holdout_calibration_20261121.md records its output. With a
flag that has no effect and varies by group, treating rows as independent
rejected in 22.3% of datasets and using the group column in 7.5%, against a
5% target. Interval coverage was 93.2% to 96.3% across the four designs.
Where the method misses, it misses on the permissive side.

README: mention --holdout-confirm and --group-col, and call the L4 option a
weight-space edit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoBWQhSUCKmU2rGbRh5ALP
main moved on by 22 commits (PR #151). The only conflict was CHANGELOG.md,
where both sides added entries under Unreleased; both sets are kept.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoBWQhSUCKmU2rGbRh5ALP
… p-values

Found by running the command line on files on disk with no coding agent
installed.

- Keyword recipes come from the host, not the agent. They were dropped
  when the exploration failed, so the run printed "froze 5 keyword
  recipes" and then confirmed nothing. They are now kept and re-tested.
- adjudication.p_values said "percentile bootstrap" for every held-out
  family, including ones whose p-values came from the exact test. It now
  lists the tests that were used.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KoBWQhSUCKmU2rGbRh5ALP
@jiaq-liu
jiaq-liu merged commit dbccfaa into main Nov 22, 2026
5 checks passed
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.

2 participants