Files
ML-Porosity/scripts/56_gp_misspec_table.py
lamlvh eff975cc96 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>
2026-11-17 11:20:54 +00:00

25 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Misspecification table for the journal article (review item W4). Reads the locked summaries in
outputs/bench/summary/ (s2_h2a.csv, s2_smc.csv) and outputs/gp_review/ is not needed; writes LaTeX rows to
outputs/gp_review/tables/misspec.tex. Descriptive; no new computation."""
import pandas as pd, pathlib
root = pathlib.Path(__file__).resolve().parents[1]
h = pd.read_csv(root / "outputs/bench/summary/s2_h2a.csv")
m = pd.read_csv(root / "outputs/bench/summary/s2_smc.csv")
h = h[h.regime == "R10"]; m = m[m.regime == "R10"]
NAME = [("rp_L1", "Rock physics, mild"), ("rp_L2", "Rock physics, strong"),
("wv_L1", "Wavelet phase, mild"), ("wv_L2", "Wavelet phase, strong"),
("wv_Q", "Attenuation"), ("dr_L1", "Scaled warp prior"), ("dr_L2", "Out-of-family warp")]
NOM = {4: (0.857, 0.805, 0.922), 16: (0.782, 0.748, 0.813)} # Table S9, hash-locked nominal cell
NOMSMC = {4: (1.20, 0.85), 16: (0.63, 0.89)} # Table S15 (warp RMSE ms, cov90)
def cell(r): return f"{r.ratio:.3f} [{r.ratio_lo:.3f}, {r.ratio_hi:.3f}]"
rows = [f"Nominal (assumed model) & {NOM[4][0]:.3f} [{NOM[4][1]:.3f}, {NOM[4][2]:.3f}] & {NOM[16][0]:.3f} [{NOM[16][1]:.3f}, {NOM[16][2]:.3f}] "
f"& {NOMSMC[4][0]:.2f} / {NOMSMC[16][0]:.2f} & {NOMSMC[4][1]:.2f} / {NOMSMC[16][1]:.2f} \\\\", r"\midrule"]
for key, lab in NAME:
a = h[(h.preset == key) & (h.n_train == 4)].iloc[0]; b = h[(h.preset == key) & (h.n_train == 16)].iloc[0]
s4 = m[(m.preset == key) & (m.n_train == 4)].iloc[0]; s16 = m[(m.preset == key) & (m.n_train == 16)].iloc[0]
rows.append(f"{lab} & {cell(a)} & {cell(b)} & {s4.warp_rmse_ms:.2f} / {s16.warp_rmse_ms:.2f} & {s4.warp_cov90:.2f} / {s16.warp_cov90:.2f} \\\\")
(root / "outputs/gp_review/tables").mkdir(parents=True, exist_ok=True)
(root / "outputs/gp_review/tables/misspec.tex").write_text("\n".join(rows) + "\n")
print("\n".join(rows))