Files
sim-numerics/table_wins_losses.py
T
vvsandClaude Opus 5 baa93963cf PREREG_flat_exp_limit outcome: ACCEPTED (server numbers equal to the smoke in every projection cell; 0 violations in the guaranteed family).
Translation limit of the analogy (f shrank, x-scale did not -> m = inf):
  defect + remembered + point + exp        APS 2531  CHA 1972  both 4503
  G2 + defect + remembered + point + exp   APS 2588  CHA 1997  both 4585
  G2 + contra + remembered + point + exp   APS 2773  CHA 2073  both 4846
  Chandrupatla                             APS 2787  CHA 2441  both 5228
Per problem against Chandrupatla now SIGNIFICANT ON BOTH SETS: G2+contra+rem+pt+exp APS 98/18/37 p=1.5e-7, CHA 28/3/9 p=0.0026; defect+rem+pt+exp APS 86/20/47 p=9e-4, CHA 27/3/10 p=0.0076.
NOT where predicted: fun9 only -1..-3; the gain is on the flat families (x^9 177 -> 161, x^19 339 -> 167).
Server regression x2: 1179 passed, 1 failed = the paper-number check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 18:44:23 +01:00

65 lines
2.8 KiB
Python

"""Comparative table of our wins and losses (server results only).
Variants of the proposed rule (tent, 3-point, projection) against the library Chandrupatla,
Brent (brentq) and TOMS748: totals per set, both sets, and per-problem wins/ties/losses with
the sign test; then the wide-bracket set per family.
python -u table_wins_losses.py
"""
from __future__ import annotations
import json
from analyze_extrap import h2h, sign_p
from where_we_lose import per_family
def load(p):
with open(p, encoding="utf8") as fh:
return {r["label"]: r for r in json.load(fh)}
def main():
full = load("sweep_full.json")
dc = load("sweep_defcontra.json")
op = load("sweep_orderpt.json")
ex = load("sweep_explimit.json")
rivals = {"Chandrupatla": full["chandrupatla"], "Brent": full["brent"],
"TOMS748": full["toms748"]}
ours = {
"proposed rule": full["pure.ratio.derived3.project"],
"+ G2 (step pattern)": dc["pure+extP.ratio.derived3.project"],
"+ G2 + analogy entry": dc["pure+extP+flatanalog.ratio.derived3.project"],
"+ contra + remembered analogy": dc["contra+flatanalogmem.ratio.derived3.project"],
"+ defect + remembered analogy": dc["defect+flatanalogmem.ratio.derived3.project"],
"+ G2 + analogy + ORDER POINT": op["pure+extP+flatanalogpt.ratio.derived3.project"],
"+ G2 + contra + rem. + ORDER PT": op["pure+extP+contra+flatanalogmempt.ratio.derived3.project"],
"+ defect + rem. + ORDER POINT": op["defect+flatanalogmempt.ratio.derived3.project"],
"+ G2 + contra + rem. + pt + EXP": ex["pure+extP+contra+flatanalogmempt+exp.ratio.derived3.project"],
"+ defect + rem. + pt + EXP": ex["defect+flatanalogmempt+exp.ratio.derived3.project"],
}
print("TOTALS (evaluations of f, failures charged 200)")
print(f" {'method':<32} {'APS':>6} {'CHA':>6} {'both':>6}")
for name, r in list(ours.items()) + list(rivals.items()):
print(f" {name:<32} {r['APS']['total']:6d} {r['CHA']['total']:6d} "
f"{r['APS']['total'] + r['CHA']['total']:6d}")
print("\nPER PROBLEM, ours against each rival: wins/ties/losses (sign-test p)")
for s in ("APS", "CHA"):
print(f" {s}")
for name, r in ours.items():
cells = []
for rn, rv in rivals.items():
w, t, l = h2h(r, rv, s)
cells.append(f"{rn} {w}/{t}/{l} p={sign_p(w, l):.2g}")
print(f" {name:<32} " + " ".join(cells))
print("\nCHA PER FAMILY (ours / Chandrupatla)")
fams = sorted(per_family(rivals["Chandrupatla"], "CHA"))
print(" " + " " * 32 + "".join(f"{f:>9}" for f in fams))
for name, r in list(ours.items()) + [("Chandrupatla", rivals["Chandrupatla"])]:
pf = per_family(r, "CHA")
print(f" {name:<32}" + "".join(f"{pf[f]:9d}" for f in fams))
if __name__ == "__main__":
main()