Step 5: pre-training on the rules' outputs (pretrain.py, m2.py --pretrain); regressions as detectors/bench/compare.py; the reader from the tools repository

The detectors were simplified on 2026-11-16: the reader moved to aimsight-tools (scripts/data.py, put on the path by
categories.py) and a regression is now a Total losing more than 1 point, or a family of a station losing more than
5 points and more than 20 instants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-17 09:51:56 +01:00
1 parent 7312a1c3ca
commit 5337dd0dac
6 files changed
+147 -51

No files matched your search

+6 -5
View File
@@ -155,9 +155,10 @@ def station_features(f, kinds, grid, camera, temperature, measurements):
return names, np.stack([np.asarray(c[n], float) for n in names], axis=-1)
def build(folder, labels, start, end, data):
"""A station folder, its labels and the range [start, end) (iso) -> dict of arrays."""
measurements = data.load(folder)
def build(folder, labels, start, end, data, measurements=None):
"""A station folder, its labels and the range [start, end) (iso) -> dict of arrays. measurements: the station
already read (data.load), when several ranges are built from it."""
measurements = measurements or data.load(folder)
kinds = {s: ("global_ref" if data.is_reference(v) else
"ref" if next((m["pattern_type"] for m in v if m["pattern_type"]), "") == "ref" else "target")
for s, v in measurements.items()}
@@ -178,7 +179,7 @@ def build(folder, labels, start, end, data):
def main():
p = argparse.ArgumentParser(usage=__doc__)
p.add_argument("--detectors", required=True, help="the detectors repository (scripts/data.py, bench/)")
p.add_argument("--detectors", required=True, help="the detectors repository (scripts/, bench/; the reader is tools/scripts/data.py)")
p.add_argument("--data", required=True, help="folder of the station folders")
p.add_argument("--labels", required=True, help="folder of the <STATION>.jsonl")
p.add_argument("--out", required=True)
@@ -187,9 +188,9 @@ def main():
p.add_argument("--to", dest="end")
a = p.parse_args()
sys.path[:0] = [str(Path(a.detectors) / "scripts"), str(Path(a.detectors) / "bench")]
from score import read_labels # noqa: E402 (puts the tools repository's reader on the path)
import data # noqa: E402 the reading of the benchmark
from regression import label_range # noqa: E402 the labelled range, as the benchmark
from score import read_labels # noqa: E402
out = Path(a.out)
out.mkdir(parents=True, exist_ok=True)
for path in sorted(Path(a.labels).glob("*.jsonl")):