Files
sim-numerics/table_wins_losses.py
T
vvsandClaude Opus 5 08863c170c PREREG_flat_order_point outcome: ACCEPTED, and the GOAL is reached - below Chandrupatla on BOTH sets (server numbers, all projection cells equal to the smoke).
Splitting in the flat regime at the point from the analogous pair's order (t = |FA|^(1/m) / (|FA|^(1/m) + |FB|^(1/m))) instead of the midpoint:
  G2 + analogy + order point         APS 2780  CHA 2221  both 5001   (P1-P4 all hold; vs Chandrupatla 2787 / 2441 / 5228)
  G2 + contra + remembered + point   APS 2775  CHA 2119  both 4894   (P3 fails by 2 against its midpoint twin)
  defect + remembered + point        APS 2532  CHA 2164  both 4696   (P3 fails by 2)
Flat fun3-6: 1234 -> 847 (analogy), 1151 -> 743 (remembered) - below pure bisection 1044 and Chandrupatla 1068.
Per problem on the wide set vs Chandrupatla now 20-24 wins / 13-17 losses (p 0.1-0.7, not significant); on the canonical set the edge is kept (95/20/38 p=8e-7).
Guarantee: 0 violations and >= 193 solved in every project/safe/credit cell.
Server regression x2: 1150 passed, 1 failed = the paper-number check.

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

62 lines
2.6 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")
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"],
}
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()