wf-improve: several stations on the same range (DATA, STATIONS, a labels folder); regression.py --from/--to; the agents keep their scripts in OUT/tools/

Optimizer's daily batch labels every station on one day: one session for all of them. The single-station request (Diagnostic-app) is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-14 13:53:19 +01:00
1 parent c7e34b49f7
commit 887b313ba2
5 files changed
+32 -11

No files matched your search

+8 -2
View File
@@ -1,10 +1,12 @@
"""Benchmark of the detectors against a reference truth: every labelled station.
For each <STATION>.jsonl of --labels that has its folder <STATION>/ in --data, the score per family and per instant of
score.py, over the range of its labels: from the day of the first to the midnight after the last. Then the total,
score.py, over the range of its labels: from the day of the first to the midnight after the last; with --from/--to, over
that range for every station, a station without a label on it included (several stations labelled the same days). Then the total,
family by family, which says whether the detectors do better overall. The block of a station is its score; the
others, the non-regression: a family that goes back on a station is a regression, even if the total rises.
Usage: python3 regression.py --labels <folder of <STATION>.jsonl> --data <folder of <STATION>/> [--stations A,B]
[--from YYYY-MM-DD --to YYYY-MM-DD]
"""
import argparse
from datetime import timedelta
@@ -30,7 +32,11 @@ if __name__ == "__main__":
p.add_argument("--labels", required=True, help="folder of the labels, one <STATION>.jsonl per station")
p.add_argument("--data", required=True, help="folder of the station folders, <STATION>/")
p.add_argument("--stations", help="A,B: these stations only (a shorter run)")
p.add_argument("--from", dest="start", help="YYYY-MM-DD: this range for every station, not the range of its labels")
p.add_argument("--to", dest="end", help="YYYY-MM-DD, excluded (with --from)")
a = p.parse_args()
if bool(a.start) != bool(a.end):
p.error("--from and --to go together")
total = {}
for path in sorted(Path(a.labels).glob("*.jsonl")):
station = path.stem
@@ -40,7 +46,7 @@ if __name__ == "__main__":
if not folder.is_dir():
print(f"{station}: no {folder}/, skipped\n")
continue
start, end = label_range(path)
start, end = (iso(parse_time(a.start)), iso(parse_time(a.end))) if a.start else label_range(path)
n, labels = score.family_scores(str(folder), str(path), start, end)
score.show(f"{station}: {start} → {end}, {len(labels)} labels", n)
print()