feat: omega curve and unseen-N, the two steps before psi
omega.md: a plateau at [1,4] that does not track the domain across a 4.7x range, so the bandwidth is a knob that was set wrong rather than a defect to design around. omega=8 is an optimisation cliff, not a mis-tune. The project default of 10 is outside the plateau. scale.md: one parameter set works at an entity count it never trained on -- trained on N<=16 it beats the oracle at N=32 -- and a lookup table does it too. Read against an oracle because the mse/floor ratio is not comparable across N, which is asserted as a test rather than claimed in prose. The cost runs large->small only, at 2.28x, which makes it the pooling's 1/deg dilution rather than a degree-distribution shift. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCydQraDSoZ9WoTm2v23Eb
This commit is contained in:
8 files changed
+467
-19
No files matched your search
@@ -0,0 +1,46 @@
|
||||
"""Does one parameter set still WORK at an entity count it never trained on?
|
||||
|
||||
Read against the ORACLE, never down the N axis. `y_i` is a mean over neighbours, so the target's
|
||||
variance falls as N rises and any error-over-floor ratio climbs with N for a model that is doing
|
||||
nothing wrong. The oracle -- trained over the full range [2,32] -- absorbs all of that: at each
|
||||
N, `forward / oracle` is the cost of never having seen that entity count, and nothing else.
|
||||
|
||||
Both directions are reported. A cost in BOTH is the degree distribution shifting under the mean
|
||||
pooling; a cost in ONE is the extrapolation that was actually asked for.
|
||||
"""
|
||||
import json, statistics as st
|
||||
|
||||
|
||||
def load(tag, arm):
|
||||
rs = json.load(open(f"results/scale_{tag}.json"))["rows"]
|
||||
return [r for r in rs if r["arm"] == arm]
|
||||
|
||||
|
||||
def per_n(rows, n):
|
||||
return st.mean([r["per_n"][str(n)]["mse"] for r in rows])
|
||||
|
||||
|
||||
def paired(a, b, n):
|
||||
d = [x["per_n"][str(n)]["mse"] - y["per_n"][str(n)]["mse"] for x, y in zip(a, b)]
|
||||
return st.mean(d), st.stdev(d) / len(d) ** 0.5, sum(1 for v in d if v > 0), len(d)
|
||||
|
||||
|
||||
NS = [2, 4, 8, 12, 16, 20, 24, 28, 32]
|
||||
|
||||
for arm in ("rp", "table"):
|
||||
fwd, rev, orc = (load(t, arm) for t in ("forward", "reverse", "oracle"))
|
||||
print(f"\n{'=' * 78}\n{arm.upper()} raw MSE, and cost against the oracle trained on [2,32]\n{'=' * 78}")
|
||||
print(f"{'N':>4} {'fwd[2,16]':>10} {'rev[17,32]':>11} {'oracle':>10} "
|
||||
f"{'fwd/orc':>8} {'rev/orc':>8} trained on N?")
|
||||
for n in NS:
|
||||
f, r, o = per_n(fwd, n), per_n(rev, n), per_n(orc, n)
|
||||
tag = "fwd" if n <= 16 else "rev"
|
||||
print(f"{n:>4} {f:10.5f} {r:11.5f} {o:10.5f} {f / o:8.2f} {r / o:8.2f} {tag} only")
|
||||
print()
|
||||
for label, arms_, ns in (("forward, unseen N (17-32)", fwd, [20, 24, 28, 32]),
|
||||
("reverse, unseen N (2-16)", rev, [2, 4, 8, 12])):
|
||||
ms = [paired(orc, arms_, n) for n in ns]
|
||||
tot = st.mean([m for m, _, _, _ in ms])
|
||||
won = sum(w for _, _, w, _ in ms)
|
||||
print(f" {label}: mean cost over oracle {tot:+.5f} "
|
||||
f"{won}/{sum(k for _, _, _, k in ms)} seed-points worse than oracle")
|
||||
Reference in new issue
Block a user