Why the translation limit fired late on the fun9.5 flank (diagnostics only). The limit itself reads correctly: at x = 10.89 the pair has lx 1.09, lf 1.5e-3 -> m = inf, and the regime is entered at the next flag (10.39), after which the flank is halved (5.19, 2.60, 1.30). It fires late because the flank configurations do NOT recur from 20.25 to 10.89: (1) the near-zero step 20.2502 -> 20.2501 (overconfident S ~ 1 from a slope dominated by f(81) = 1.5e35) makes the next triples degenerate (xi ~ 0, then -1.7e7) and pollutes the memory; (2) our three-point step on exp is not a translation - it alternates long/short (xi -1.43, -0.46, -4.10, -0.03, -13.9) and first repeats at lag 5 (state 10 ~ state 5). 9 evaluations from 20.25 to 10.39 where one halving would do: ~8 of the +10 gap on fun9.5.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""Why the translation limit did not fire on the exp(x) flank of fun9.5 ([2e-4, 81]).
|
||||
|
||||
Every state the gate sees (trace hook) under a prestep, in order, with what the analogy
|
||||
reads there:
|
||||
flag r = f/f_prev >= 1/4 (sign kept) - the entry also needs the last step to be the model's
|
||||
xi, phi the configuration
|
||||
ratio d_past / d_line (< 1: analogous to the nearest past configuration)
|
||||
lx, lf the pair's x-scale and f-scale ratios (translation: lf < 1 <= lx)
|
||||
m the order read with translation=True
|
||||
Nothing in the method changes.
|
||||
|
||||
python -u diag_fun9_flank.py [problem] [prestep]
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import sys
|
||||
|
||||
from simroot.pure import _analogy_order, _config3, pure_root
|
||||
from sweep_full import MAXFEV, XTOL, load_problems
|
||||
|
||||
|
||||
def main(pid_want="fun9.5", pre="defect+flatanalogmempt+exp"):
|
||||
for s, pid, f, a, b, _root in load_problems():
|
||||
if pid != pid_want:
|
||||
continue
|
||||
st = {"trace": []}
|
||||
pure_root(f, a, b, XTOL, MAXFEV, similarity="ratio", scale="derived3",
|
||||
guard="project", prestep=pre, stats=st)
|
||||
print(f"== {pid} {pre} entries {st.get('stick_entries', 0)}")
|
||||
past = []
|
||||
for k, t in enumerate(st["trace"]):
|
||||
cur = _config3(t["x"], t["fx"], t["xp"], t["fp"], t["xp2"], t["fp2"])
|
||||
flag = t["fp"] != 0.0 and t["fx"] / t["fp"] >= 0.25
|
||||
head = f" {k:3d} x {t['x']:9.4f} f {t['fx']:+9.2e} {'F' if flag else '.'}"
|
||||
if cur is None:
|
||||
print(head + " (no configuration)")
|
||||
continue
|
||||
line = abs(cur[1] - cur[0]) / math.sqrt(2.0)
|
||||
if past:
|
||||
q = min(past, key=lambda p: math.hypot(cur[0] - p[0], cur[1] - p[1]))
|
||||
ratio = math.hypot(cur[0] - q[0], cur[1] - q[1]) / line if line > 0 else math.inf
|
||||
lx = cur[2] / q[2] if q[2] > 0 else math.nan
|
||||
lf = cur[3] / q[3] if q[3] > 0 else math.nan
|
||||
m = _analogy_order(cur, past, translation=True)
|
||||
ms = "none" if m is None else ("inf" if math.isinf(m) else f"{m:.2f}")
|
||||
print(head + f" xi {cur[0]:+8.3f} phi {cur[1]:+8.3f} ratio {ratio:7.3f}"
|
||||
f" lx {lx:7.3f} lf {lf:9.3e} m {ms}")
|
||||
else:
|
||||
print(head + f" xi {cur[0]:+8.3f} phi {cur[1]:+8.3f} (no memory)")
|
||||
past.append(cur)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(*sys.argv[1:3])
|
||||
Reference in New Issue
Block a user