79 lines
6.3 KiB
Python
79 lines
6.3 KiB
Python
"""Update the expected values in verify_article.py to the regenerated server sweeps (the same
|
|
numbers now written into the paper). Exact, counted replacements; nothing written otherwise.
|
|
|
|
python -u apply_verify_numbers.py
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
PATH = "verify_article.py"
|
|
|
|
REPL = [
|
|
('("CHA", 47, 3220, 40)', '("CHA", 45, 3220, 40)', 1),
|
|
('("chandrupatla", 2, 2441), ("itp_oracle", 3, 2611),', '("chandrupatla", 2, 2441), ("itp_oracle", 3, 2647),', 1),
|
|
('("itp", 6, 2857), ("bisection", 16, 3090),', '("itp", 6, 2896), ("bisection", 16, 3090),', 1),
|
|
('("toms748", 164, 4000), ("brent", 226, 4115)]', '("toms748", 159, 4000), ("brent", 227, 4115)]', 1),
|
|
('row(rows, "CHA", "pure.cbrt.derived3.project")["total"], 4099)', 'row(rows, "CHA", "pure.cbrt.derived3.project")["total"], 4109)', 1),
|
|
('check("switch by benchmark set, both sets", switched, 6905)', 'check("switch by benchmark set, both sets", switched, 6915)', 1),
|
|
('want = {("derived3", "lin"): 6809, ("derived3", "quad"): 22294,', 'want = {("derived3", "lin"): 6893, ("derived3", "quad"): 22315,', 1),
|
|
('("derived", "lin"): 6906, ("derived", "quad"): 22167,', '("derived", "lin"): 6981, ("derived", "quad"): 22206,', 1),
|
|
('("bracket", "lin"): 10263, ("bracket", "quad"): 19137,', '("bracket", "lin"): 10279, ("bracket", "quad"): 19127,', 1),
|
|
('for sim, v in [("ratio", 6496), ("exp_abs", 6822), ("rational", 7038),', 'for sim, v in [("ratio", 6560), ("exp_abs", 6895), ("rational", 7118),', 1),
|
|
('("ratio_soft", 9502), ("sqrt", 10497), ("cbrt", 11941),', '("ratio_soft", 9578), ("sqrt", 10546), ("cbrt", 12002),', 1),
|
|
('("exp_sq", 14314), ("rat_sq", 15102), ("cosine", 16394)]:', '("exp_sq", 14307), ("rat_sq", 15102), ("cosine", 16394)]:', 1),
|
|
('for sc, v in [("derived3", 6496), ("derived", 6628), ("bracket", 9081),', 'for sc, v in [("derived3", 6560), ("derived", 6702), ("bracket", 9107),', 1),
|
|
('("slope.ratio.derived3.project", 2848, 3074)', '("slope.ratio.derived3.project", 2848, 3114)', 1),
|
|
('("pure+shape+slope.ratio.derived3.safe", 2527, 3108)', '("pure+shape+slope.ratio.derived3.safe", 2527, 3126)', 1),
|
|
('("pure+dissim+slope.ratio.derived3.project", 2726, 2785)', '("pure+dissim+slope.ratio.derived3.project", 2726, 2799)', 1),
|
|
('("pure+shape+dissim+slope.ratio.derived3.safe", 2884, 2859)', '("pure+shape+dissim+slope.ratio.derived3.safe", 2884, 2871)', 1),
|
|
('("log.ratio_soft.derived.safe", 6940, 3474)', '("log.ratio_soft.derived.safe", 6940, 3541)', 1),
|
|
('"both": (4522, 3675, 3387, 3216),', '"both": (4522, 3675, 3406, 3241),', 1),
|
|
('"bracket": (4606, 3542, 3571, 3303),', '"bracket": (4606, 3542, 3602, 3359),', 1),
|
|
('"project": (6932, 6364, 4794, 4559),', '"project": (6932, 6364, 4789, 4554),', 1),
|
|
('"safe": (5987, 5229, 4108, 3923),', '"safe": (5987, 5229, 4134, 3954),', 1),
|
|
('"step": (6435, 5551, 4257, 4022),', '"step": (6435, 5551, 4287, 4068),', 1),
|
|
('("ratio", "band", "project"): {"APS": 5432, "CHA": 3066},', '("ratio", "band", "project"): {"APS": 5432, "CHA": 3059},', 1),
|
|
('("ratio", "band", "credit"): {"CHA": 2899},', '("ratio", "band", "credit"): {"CHA": 2892},', 1),
|
|
('("ratio_soft", "simpair", "project"): {"CHA": 2868},', '("ratio_soft", "simpair", "project"): {"CHA": 2897},', 1),
|
|
('DECISION_RATES = {"band": 63.6, "defect": 7.0}', 'DECISION_RATES = {"band": 63.5, "defect": 6.6}', 1),
|
|
('check("flat: ours max", round(max(per[p][2] for p in flat), 2), 0.81)', 'check("flat: ours max", round(max(per[p][2] for p in flat), 2), 0.75)', 1),
|
|
('check("bracketing states in total", mo["neg_all"], 433)', 'check("bracketing states in total", mo["neg_all"], 431)', 1),
|
|
('check("total gap on the losing problems", sum(gap.values()), 244)', 'check("total gap on the losing problems", sum(gap.values()), 256)', 1),
|
|
('for k in ("fun3", "fun4", "fun5", "fun6")), 160)', 'for k in ("fun3", "fun4", "fun5", "fun6")), 172)', 1),
|
|
('check("m>=2 on flat states %", round(fl["CHA flat fun3-6"][2], 1), 5.8)', 'check("m>=2 on flat states %", round(fl["CHA flat fun3-6"][2], 1), 0.0)', 1),
|
|
('("fun6", 456, 235)):', '("fun6", 456, 228)):', 1),
|
|
('check("log item: x-space control CHA", xcell["CHA"]["total"], 3643)', 'check("log item: x-space control CHA", xcell["CHA"]["total"], 3695)', 1),
|
|
('("CHA", PROJ, 47),', '("CHA", PROJ, 45),', 1),
|
|
('by["pure.exp_abs.bracket.both"]["CHA"]["total"],\n 2733)', 'by["pure.exp_abs.bracket.both"]["CHA"]["total"],\n 2736)', 1),
|
|
('(CREDIT, "CHA", "itp_oracle", (2, 3, 35)),', '(CREDIT, "CHA", "itp_oracle", (2, 2, 36)),', 1),
|
|
('("itp_oracle", 5871), ("toms748", 6820), ("brent", 7004)):', '("itp_oracle", 5907), ("toms748", 6820), ("brent", 7004)):', 1),
|
|
('check("best constant-free configuration", top["label"], "defect.ratio.derived3.credit")',
|
|
'check("best constant-free configuration", top["label"],\n "defect+flatanalogmempt+exp+half.ratio.derived3.credit")', 1),
|
|
('check("its total over both sets", top["APS"]["total"] + top["CHA"]["total"], 6494)',
|
|
'check("its total over both sets", top["APS"]["total"] + top["CHA"]["total"], 6111)\n'
|
|
' d = cells["defect.ratio.derived3.credit"]\n'
|
|
' check("defect under the earned projection, both sets",\n'
|
|
' d["APS"]["total"] + d["CHA"]["total"], 6494)', 1),
|
|
('"sweep_direction.json": ("CHA", "pure+dissim+slope.ratio.derived3.safe", 2683),', '"sweep_direction.json": ("CHA", "pure+dissim+slope.ratio.derived3.safe", 2695),', 1),
|
|
('check("CHA vs Chandrupatla sign test p (rounded)", round(sign_p(w, l), 3), 0.006)',
|
|
'check("CHA vs Chandrupatla sign test p (rounded)", round(sign_p(w, l), 3), 0.006)', 1),
|
|
]
|
|
|
|
|
|
def main():
|
|
with open(PATH, encoding="utf8") as fh:
|
|
text = fh.read()
|
|
bad = [(o, n, text.count(o)) for o, _new, n in REPL if text.count(o) != n]
|
|
if bad:
|
|
for o, n, got in bad:
|
|
print(f"expected {n}, found {got}: {o[:90]}")
|
|
raise SystemExit("aborted, nothing written")
|
|
for o, new, _n in REPL:
|
|
text = text.replace(o, new)
|
|
with open(PATH, "w", encoding="utf8") as fh:
|
|
fh.write(text)
|
|
print(f"{len(REPL)} expected values updated")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|