sessions of 2026-11-18 (the optimization campaign; three runs without summary, interrupted and rerun)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 17:47:59 +01:00
1 parent 8a81c53cd9
commit 0cfbd1b7bc
363 files changed
+30822

No files matched your search

@@ -0,0 +1,33 @@
"""Per station: references rejected (error_value > threshold and > 2x its median), their error_value/threshold ratio, grouped by the family of the label covering the instant (quartiles).
Usage: python3 refratio.py <data folder> <labels folder> STATION ...
"""
import json
import statistics
import sys
from pathlib import Path
ROOT = Path("/home/maxime/aimsight-optimizer")
sys.path[:0] = [str(ROOT / "detectors" / "scripts"), str(ROOT / "tools" / "scripts")]
from data import load, is_reference, iso # noqa: E402
data, labels = Path(sys.argv[1]), Path(sys.argv[2])
for st in sys.argv[3:]:
labs = [json.loads(x) for x in open(labels / f"{st}.jsonl") if x.strip()]
out = {}
for s, ms in load(str(data / st)).items():
if not is_reference(ms):
continue
e = [m["error_value"] for m in ms if m["error_value"] is not None]
if not e:
continue
med = statistics.median(e)
for m in ms:
x, th = m["error_value"], m["error_threshold"]
if x is None or not th or x <= th or x <= 2 * med:
continue
t = iso(m["t"])
fam = ",".join(sorted({l["family"] for l in labs if l["start"] < t < l["end"]})) or "-"
out.setdefault(fam, []).append(x / th)
for fam, r in sorted(out.items()):
q = statistics.quantiles(r, n=4) if len(r) > 1 else r * 3
print(f"{st:12} {fam:40} n={len(r):4} q1={q[0]:.2f} med={q[1]:.2f} q3={q[2]:.2f}")