Address simulated GP referee reports: E1-E6 and A1-A9 (exploratory), theory scope, per-well field and anchor-error tables, scorer v1.1, paper_gp and response letter

Experiments declared and hashed before computing (docs/research/gp-review-*.md). The SMC-mean gain holds against a practitioner tie, all budgets and a same-target point tie, but is lost at anchor errors of 2 ms or less and reverses with per-well bulk error. No locked protocol, verdict or threshold changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 11:20:54 +00:00
parent 883dccfe21
commit eff975cc96
91 changed files with 8595 additions and 14266 deletions

View File

@@ -23,12 +23,15 @@ score Predictions <pred>/<split>/<setting>/r{rid}_c{c}_n{N}_s{seed}.npz with
(8, 126), porosity in p.u., test wells in task order. Metrics are those of the runner (scripts/11 evaluate).
On the test split the locked rules of ml_porosity/benchmark/summary.py are applied per cell: the H2a cell
rule against the best point tie {B3b, B3c, B3c-R}, and the `better` rule against B3d-Sa, M2-Sa, Oracle
(PM2, BK2, Oracle in the two-mode settings). Reference rows are restricted to the submitted realizations and
seeds. Bootstrap CIs use one generator (rng 0) per cell, so they can differ slightly from the summary
tables; no rule uses a CI. → <pred>/score/
(PM2, BK2, Oracle in the two-mode settings). Scorer v1.1 (17/11/2026, after the Geophysical Prospecting
review) adds the anchor mean B3d: the same H2a cell rule against the best of {B3b, B3c, B3c-R, B3d}
(rule_point_ties_anchor.csv; only the nominal settings have B3d) and the `better` rule against B3d. The v1
outputs are unchanged and no task file or hash changed. Reference rows are restricted to the submitted
realizations and seeds. Bootstrap CIs use one generator (rng 0) per cell, so they can differ slightly from
the summary tables; no rule uses a CI. → <pred>/score/
selftest Writes saved predictions of reference methods as a submission (S1 R10 c = 1.5, S2 R10 wv_L1, P2r R10 c = 1,
S8 R10 Δ = 16), scores it, and checks that metrics and rule outputs equal those of the reference runs and
that the package truth equals the y_true saved by the runner.
that the package truth equals the y_true saved by the runner; v1.1 also checks the anchor-mean rule.
check Recomputes the content hashes of DIR against benchmark/MANIFEST.json (for a downloaded copy).
Outside the code hash of the protocol_bench lock (scripts/34 and ml_porosity/ only); generate and tables check the
@@ -64,6 +67,8 @@ RUN = ["setting", "c", "n_train", "rid", "seed", "method"]
PRED = re.compile(r"r(\d+)_c([\d.]+)_n(\d+)_s(\d+)")
WIDE_MS = 1.5 # rules.wide of protocol_bench
N_BOOT = 2000
SCORER_VERSION = "1.1" # 1.0: 02/11/2026; 1.1: anchor mean B3d added as a competitor (17/11/2026)
ANCHOR_TIES = [*S.POINT_TIES, "B3d"]
SIGMA_A_STRESS = (3.5, 14.0) # σ_a stated in the task file of the settings R10__sa3.5 and R10__sa14 (true value 7 ms)
@@ -204,7 +209,7 @@ def generate(a) -> None:
"'key|dtype|shape|' then the C-order bytes (scripts/37_bench_package.py content_sha)",
"inputs": {f"inputs/{f.name}": file_sha(f) for f in sorted(src.iterdir()) if f.name != "analyst.json"},
"splits": {sp: rids[sp] for sp in sorted(set(old.get("splits", {})) | set(a.split))},
"n_tasks": int(len(idx)), "files": dict(sorted((keep | files).items()))}
"scorer_version": SCORER_VERSION, "n_tasks": int(len(idx)), "files": dict(sorted((keep | files).items()))}
(out / "MANIFEST.json").write_text(json.dumps(man, indent=1))
ref = DOC / "MANIFEST.json"
if ref.exists() and not a.update_manifest:
@@ -346,8 +351,8 @@ def read_predictions(pred: Path, pkg: Path, name: str, f_c: float) -> pd.DataFra
return pd.DataFrame(rows)
def rule_tables(run: pd.DataFrame, ref: pd.DataFrame, name: str) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
rules, pairs, means = [], [], []
def rule_tables(run: pd.DataFrame, ref: pd.DataFrame, name: str) -> tuple[pd.DataFrame, ...]:
rules, anch, pairs, means = [], [], [], []
for (setting, c, N), sub in run.groupby(CELL):
r = ref[(ref.setting == setting) & (ref.c == c) & (ref.n_train == N) & ref.rid.isin(sub.rid) & ref.seed.isin(sub.seed)]
both = pd.concat([sub[RUN + S.METRICS], r[RUN + S.METRICS]], ignore_index=True)
@@ -356,14 +361,18 @@ def rule_tables(run: pd.DataFrame, ref: pd.DataFrame, name: str) -> tuple[pd.Dat
if set(S.POINT_TIES) <= set(r.method):
cells = S.h2a_cells(both, name, S.POINT_TIES, np.random.default_rng(0), N_BOOT)
rules.append(cells.drop(columns=["c", "n_train", "n_rid", "n_seed"]).assign(**key))
for m in ("B3d-Sa", "M2-Sa", "PM2", "BK2", "Oracle"):
if set(ANCHOR_TIES) <= set(r.method): # v1.1: anchor mean among the competitors
cells = S.h2a_cells(both, name, ANCHOR_TIES, np.random.default_rng(0), N_BOOT)
anch.append(cells.drop(columns=["c", "n_train", "n_rid", "n_seed"]).assign(**key))
for m in ("B3d-Sa", "M2-Sa", "B3d", "PM2", "BK2", "Oracle"):
if m in set(r.method):
d = S.pair(both, name, m, np.random.default_rng(0), N_BOOT)
pairs.append(key | {"reference": m} | d)
first = lambda df, cols: df[[*cols, *[k for k in df.columns if k not in cols]]] if len(df) else df
k = ["setting", "c", "n_train", "n_rid", "n_seed"]
rules = pd.concat(rules, ignore_index=True) if rules else pd.DataFrame()
return first(rules, k), first(pd.DataFrame(pairs), k + ["reference"]), first(pd.DataFrame(means), k)
anch = pd.concat(anch, ignore_index=True) if anch else pd.DataFrame()
return first(rules, k), first(anch, k), first(pd.DataFrame(pairs), k + ["reference"]), first(pd.DataFrame(means), k)
def score(a) -> None:
@@ -379,33 +388,42 @@ def score(a) -> None:
well.to_csv(out / "per_well.csv", index=False)
run.to_csv(out / "runs.csv", index=False)
test = run[run.split == "test"].drop(columns="split")
L = [f"# Score of `{a.name}` (scripts/37_bench_package.py score)", "",
L = [f"# Score of `{a.name}` (scripts/37_bench_package.py score, scorer v{SCORER_VERSION})", "",
f"{len(well.groupby(['split', *RUN]))} predictions; test split: {len(test)} runs in {test.groupby(CELL).ngroups} cells.",
"Rules: protocol_bench (improves: band RMSE ≤ 0.90 × best point tie or band PCC ≥ +0.05; cell_pass: ≥ 4/5 seeds "
"and > 1/2 of realizations; better: lower band RMSE in ≥ 4/5 seeds and > 1/2 of realizations).", ""]
if len(test):
rules, pairs, means = rule_tables(test, ref, a.name)
for f, df in (("rule_point_ties.csv", rules), ("pairs.csv", pairs), ("cells.csv", means)):
rules, anch, pairs, means = rule_tables(test, ref, a.name)
for f, df in (("rule_point_ties.csv", rules), ("rule_point_ties_anchor.csv", anch), ("pairs.csv", pairs),
("cells.csv", means)):
df.to_csv(out / f, index=False)
complete = lambda df: df[(df.n_rid == 8) & (df.n_seed == 5)] if len(df) else df
if len(rules):
rc = complete(rules)
L += [f"- H2a cell rule vs best point tie: {int(rules.cell_pass.sum())}/{len(rules)} cells pass "
f"({int(rc.cell_pass.sum())}/{len(rc)} among complete cells: 8 realizations × 5 seeds)."]
for m in ("B3d-Sa", "M2-Sa", "PM2", "BK2", "Oracle"):
if len(anch):
ac = complete(anch)
L += [f"- v1.1 H2a cell rule vs best of point ties and anchor mean B3d: {int(anch.cell_pass.sum())}/{len(anch)} "
f"cells pass ({int(ac.cell_pass.sum())}/{len(ac)} among complete cells; nominal settings only)."]
for m in ("B3d-Sa", "M2-Sa", "B3d", "PM2", "BK2", "Oracle"):
q = pairs[pairs.reference == m] if len(pairs) else pairs
if len(q):
L += [f"- better than {m}: {int(q.better.sum())}/{len(q)} cells; median ratio {q.ratio.median():.3f}."]
L += ["", "| setting | c | N | n_rid × n_seed | ratio vs best point tie (best) | cell_pass | ratio vs B3d-Sa |",
"|---|---|---|---|---|---|---|"]
L += ["", "| setting | c | N | n_rid × n_seed | ratio vs best point tie (best) | cell_pass | "
"ratio vs best of point ties and B3d (best) | cell_pass (v1.1) | ratio vs B3d-Sa |",
"|---|---|---|---|---|---|---|---|---|"]
rr = rules.set_index(CELL) if len(rules) else None
ra = anch.set_index(CELL) if len(anch) else None
pb = pairs[pairs.reference == "B3d-Sa"].set_index(CELL) if len(pairs) else None
for row in means.itertuples():
k = (row.setting, row.c, row.n_train)
h = f"{rr.loc[k, 'ratio']:.3f} ({rr.loc[k, 'best']})" if rr is not None and k in rr.index else "—"
cp = str(bool(rr.loc[k, "cell_pass"])) if rr is not None and k in rr.index else "—"
ha = f"{ra.loc[k, 'ratio']:.3f} ({ra.loc[k, 'best']})" if ra is not None and k in ra.index else "—"
ca = str(bool(ra.loc[k, "cell_pass"])) if ra is not None and k in ra.index else "—"
b = f"{pb.loc[k, 'ratio']:.3f}" if pb is not None and k in pb.index else "—"
L.append(f"| {row.setting} | {row.c:g} | {row.n_train} | {row.n_rid} × {row.n_seed} | {h} | {cp} | {b} |")
L.append(f"| {row.setting} | {row.c:g} | {row.n_train} | {row.n_rid} × {row.n_seed} | {h} | {cp} | {ha} | {ca} | {b} |")
dev = run[run.split == "dev"]
if len(dev):
L += ["", f"Dev split: {len(dev)} runs, metrics only (runs.csv); dev labels may be used for design."]
@@ -448,6 +466,7 @@ def selftest(a) -> None:
ref = pd.read_csv(pkg / "reference" / "runs.csv.gz")
got = pd.read_csv(sub / "score" / "runs.csv")
rules = pd.read_csv(sub / "score" / "rule_point_ties.csv")
anch = pd.read_csv(sub / "score" / "rule_point_ties_anchor.csv")
pairs = pd.read_csv(sub / "score" / "pairs.csv")
msg, ok = [f"max |y_true(runner, float32) − y_test(package)| = {worst_y:.2e} p.u."], worst_y < 1e-4
for setting, _, _, c, m in SELFTEST:
@@ -464,6 +483,11 @@ def selftest(a) -> None:
have = rules[(rules.setting == setting) & (rules.c == c) & (rules.n_train == N)].iloc[0]
same = want.best == have.best and bool(want.cell_pass) == bool(have.cell_pass) and abs(want.ratio - have.ratio) < 1e-4
line += f"; N={N} ratio {have.ratio:.4f} vs {want.ratio:.4f} ({want.best}, pass {bool(want.cell_pass)})"
if set(ANCHOR_TIES) <= set(cr.method): # v1.1 anchor-mean rule
wa = S.h2a_cells(cr, m, ANCHOR_TIES, np.random.default_rng(0), N_BOOT).iloc[0]
ha = anch[(anch.setting == setting) & (anch.c == c) & (anch.n_train == N)].iloc[0]
same &= wa.best == ha.best and bool(wa.cell_pass) == bool(ha.cell_pass) and abs(wa.ratio - ha.ratio) < 1e-4
line += f" | v1.1 {ha.ratio:.4f} vs {wa.ratio:.4f} ({wa.best}, pass {bool(wa.cell_pass)})"
else:
want = S.pair(cr, m, "PM2", np.random.default_rng(0), N_BOOT)
have = pairs[(pairs.setting == setting) & (pairs.c == c) & (pairs.n_train == N) & (pairs.reference == "PM2")].iloc[0]
@@ -472,7 +496,7 @@ def selftest(a) -> None:
ok &= same
msg.append(line)
print("\n".join(msg))
(pkg / "selftest.json").write_text(json.dumps({"pass": bool(ok), "checks": msg}, indent=1))
(pkg / "selftest.json").write_text(json.dumps({"pass": bool(ok), "scorer_version": SCORER_VERSION, "checks": msg}, indent=1))
shutil.rmtree(sub)
if not ok:
raise SystemExit("selftest FAILED")