Files
chrnxandClaude Opus 5 6c545fd035 feat: unseen relations -- the one property that separates the RP from a GNN
A GNN holds fixed weights per edge type: a lookup with one entry per discrete
relation. The CPPN computes weights from geometry, so it has something to say
about a displacement absent from training. Every chess run trained and evaluated
on the same offset grid, so this had never been tested.

Student-teacher with an analytic Gabor kernel; held-out cells masked out of
training via the RP's own mask argument; evaluation always on pairs so seen and
unseen measure the same object. Eight seeds, two hold-out structures.

The property is real -- held-out error 1.28x seen error, lower on 3/8 seeds -- and
smaller than the framing assumed. The bare table fails by construction and is
labelled as scale, not evidence. Against a table plus neighbour diffusion the
CPPN wins interpolation 2x on 6/8 seeds and loses extrapolation on 8/8. At
omega=10, the default every chess run used, it is 17x worse and below the
smoothed table even on interpolation.

The boundary is the useful part: the diffusion control exists only because the
relation space was enumerable. Chess is exactly such a domain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCydQraDSoZ9WoTm2v23Eb
2026-09-07 17:02:46 -05:00

50 lines
2.1 KiB
Python

"""Paired comparison across the arms of unseen.py. Per-seed values, seeds won, paired se."""
import json, statistics as st
def rows(path, arm=None):
rs = json.load(open(path))["rows"]
return {r["seed"]: r for r in rs if arm is None or r["arm"] == arm}
def paired(a, b, key="unseen"):
d = [b[s][key] - a[s][key] for s in sorted(a)]
return st.mean(d), st.stdev(d) / len(d) ** 0.5, sum(1 for x in d if x > 0), len(d)
def col(d, key="unseen"):
return st.mean([r[key] for r in d.values()])
for kind in ("random", "band"):
rp = rows(f"results/unseen_{kind}.json", "rp")
tb = rows(f"results/unseen_{kind}.json", "table")
it = rows(f"results/unseen_{kind}_interp.json", "table_interp")
try:
w10 = rows(f"results/unseen_{kind}_w10.json", "rp")
except FileNotFoundError:
w10 = None
print(f"\n{'=' * 72}\n{kind.upper()} hold-out, {rp[0]['n_held']}/225 cells "
f"(MSE on held-out relations, lower is better)\n{'=' * 72}")
print(f"{'seed':>4} {'rp':>10} {'table':>10} {'tbl+interp':>12} {'rp w=10':>10} {'floor':>10}")
for s in sorted(rp):
w = f"{w10[s]['unseen']:10.5f}" if w10 else f"{'-':>10}"
print(f"{s:>4} {rp[s]['unseen']:10.5f} {tb[s]['unseen']:10.5f} "
f"{it[s]['unseen']:12.5f} {w} {rp[s]['floor_unseen']:10.5f}")
wm = f"{col(w10):10.5f}" if w10 else f"{'-':>10}"
print(f"{'mean':>4} {col(rp):10.5f} {col(tb):10.5f} {col(it):12.5f} {wm} "
f"{col(rp, 'floor_unseen'):10.5f}")
for name, other in (("table", tb), ("table+interp", it)):
m, se, won, n = paired(rp, other)
verdict = ("inside one se of zero" if abs(m) < se
else ("rp better" if m > 0 else "*** rp WORSE ***"))
print(f"\n {name:12s} - rp: {m:+.5f} +/- {se:.5f} {won}/{n} seeds {verdict}")
if w10:
m, se, won, n = paired(rp, w10)
print(f" omega=10 - rp: {m:+.5f} +/- {se:.5f} {won}/{n} seeds")
r = [rp[s]["unseen"] / rp[s]["seen"] for s in sorted(rp)]
print(f"\n rp unseen/seen mean {st.mean(r):.2f} per seed {' '.join(f'{x:.2f}' for x in r)}")