Detector-learner: regression.py is the global benchmark on all the labeler's labels, with its history (detector-learner/historique.csv) to compare sessions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7fcc7264d3
commit
dbff2b947a
2 files changed
+104
-9
No files matched your search
@@ -1,11 +1,15 @@
|
|||||||
"""Non-régression de /detector-learner (D-116) : les détecteurs face aux étiquettes de l'étiqueteur des autres stations.
|
"""Non-régression de /detector-learner (D-116) : les détecteurs face aux étiquettes de l'étiqueteur des autres stations.
|
||||||
|
|
||||||
Pour chaque station de labeling/auto/ (sauf celle de la séance, --sauf) qui a son dossier dans data/, le score par
|
Pour chaque station de labeling/auto/ (sauf --sauf) qui a son dossier dans data/, le score par famille et par instant
|
||||||
famille et par instant de score.py (D-112), sur la plage de ses étiquettes : du jour de la première à minuit après la
|
de score.py (D-112), sur la plage de ses étiquettes : du jour de la première à minuit après la dernière. Puis le total,
|
||||||
dernière. Puis le total, famille par famille. Il tient lieu du benchmark sur la base d'events : une famille qui recule
|
famille par famille : le benchmark de /detector-learner, sur toutes les étiquettes de l'étiqueteur, qui dit si les
|
||||||
sur une station est un recul, même si le total monte.
|
détecteurs font globalement mieux d'une séance à l'autre. Une famille qui recule sur une station est un recul, même si
|
||||||
Usage : python3 .claude/skills/detector-learner/regression.py [--sauf STATION]
|
le total monte. Avec --etape, chaque ligne (stations et Total) entre dans l'historique, detector-learner/historique.csv,
|
||||||
|
avec la version des détecteurs (benchmark.version()).
|
||||||
|
Usage : python3 .claude/skills/detector-learner/regression.py [--sauf STATION] [--seance <séance> --etape <étape>]
|
||||||
"""
|
"""
|
||||||
|
import argparse
|
||||||
|
import csv
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -13,8 +17,11 @@ import sys
|
|||||||
|
|
||||||
RACINE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..")
|
RACINE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..")
|
||||||
sys.path.insert(0, os.path.join(RACINE, ".claude", "skills", "events-learner"))
|
sys.path.insert(0, os.path.join(RACINE, ".claude", "skills", "events-learner"))
|
||||||
|
import benchmark # noqa: E402
|
||||||
import score # noqa: E402
|
import score # noqa: E402
|
||||||
|
|
||||||
|
HISTORIQUE = os.path.join(RACINE, "detector-learner", "historique.csv")
|
||||||
|
|
||||||
|
|
||||||
def plage(chemin):
|
def plage(chemin):
|
||||||
"""labeling/auto/<STATION>.jsonl -> (début, fin) iso, en jours entiers UTC, fin exclue."""
|
"""labeling/auto/<STATION>.jsonl -> (début, fin) iso, en jours entiers UTC, fin exclue."""
|
||||||
@@ -27,10 +34,13 @@ def plage(chemin):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if sys.argv[1:] and sys.argv[1:2] != ["--sauf"]:
|
p = argparse.ArgumentParser(usage=__doc__)
|
||||||
sys.exit(__doc__)
|
p.add_argument("--sauf")
|
||||||
sauf = sys.argv[2].upper() if len(sys.argv) > 2 else None
|
p.add_argument("--seance", default="")
|
||||||
total = {}
|
p.add_argument("--etape")
|
||||||
|
a = p.parse_args()
|
||||||
|
sauf = a.sauf.upper() if a.sauf else None
|
||||||
|
total, res = {}, {}
|
||||||
for chemin in sorted(glob.glob(os.path.join(RACINE, "labeling", "auto", "*.jsonl"))):
|
for chemin in sorted(glob.glob(os.path.join(RACINE, "labeling", "auto", "*.jsonl"))):
|
||||||
station = os.path.basename(chemin)[:-len(".jsonl")]
|
station = os.path.basename(chemin)[:-len(".jsonl")]
|
||||||
dossier = os.path.join(RACINE, "data", station)
|
dossier = os.path.join(RACINE, "data", station)
|
||||||
@@ -43,6 +53,18 @@ if __name__ == "__main__":
|
|||||||
n, etiq = score.familles_lot(dossier, du, au)
|
n, etiq = score.familles_lot(dossier, du, au)
|
||||||
score.afficher(f"{station} : {du} → {au}, {len(etiq)} étiquettes", n)
|
score.afficher(f"{station} : {du} → {au}, {len(etiq)} étiquettes", n)
|
||||||
print()
|
print()
|
||||||
|
res[station] = n
|
||||||
for k, v in n.items():
|
for k, v in n.items():
|
||||||
total[k] = [a + b for a, b in zip(total.get(k, [0, 0, 0]), v)]
|
total[k] = [a + b for a, b in zip(total.get(k, [0, 0, 0]), v)]
|
||||||
score.afficher("Total", total)
|
score.afficher("Total", total)
|
||||||
|
if a.etape:
|
||||||
|
res["Total"] = total
|
||||||
|
os.makedirs(os.path.dirname(HISTORIQUE), exist_ok=True)
|
||||||
|
neuf = not os.path.exists(HISTORIQUE)
|
||||||
|
date, ver = benchmark.datetime.now(benchmark.timezone.utc).strftime("%Y-%m-%dT%H:%MZ"), benchmark.version()
|
||||||
|
with open(HISTORIQUE, "a", newline="", encoding="utf-8") as f:
|
||||||
|
w = csv.writer(f)
|
||||||
|
if neuf:
|
||||||
|
w.writerow(("date", "seance", "etape", "version", "station", "famille", "etiquetees", "signalees", "les_deux"))
|
||||||
|
w.writerows((date, a.seance, a.etape, ver, st, k, *v) for st, n in res.items() for k, v in sorted(n.items()))
|
||||||
|
print(f"\nhistorique : {os.path.relpath(HISTORIQUE, RACINE)} (version {ver})")
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
date,seance,etape,version,station,famille,etiquetees,signalees,les_deux
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,BREITHORN,deplacement,171,11,11
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,BREITHORN,obstruction,71,12,12
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,BREITHORN,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,BREITHORN,visibilite,0,34,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,cible_a_probleme,571,2433,571
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,deplacement,0,2433,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,deplacement_thermique,504,889,201
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,obstruction,0,191,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,sans famille,576,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,saut_bref,0,14,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,trou,0,4,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,JUNGFRAU,visibilite,47,287,25
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,MICHIGAN,cible_a_probleme,133,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,MICHIGAN,deplacement,9,1,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,MICHIGAN,deplacement_thermique,135,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,MICHIGAN,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NEBRASKA,cible_a_probleme,133,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NEBRASKA,deplacement,53,2,1
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NEBRASKA,deplacement_thermique,91,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NEBRASKA,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NEBRASKA,visibilite,10,1,1
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NORDEND,deplacement_thermique,332,318,316
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NORDEND,obstruction,6,83,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NORDEND,trou,2,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,NORDEND,visibilite,111,13,11
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,WILDSTRUBEL,deplacement_thermique,0,126,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,WILDSTRUBEL,obstruction,294,193,107
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,WILDSTRUBEL,visibilite,290,113,108
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,cible_a_probleme,837,2433,571
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,deplacement,233,2447,12
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,deplacement_thermique,1062,1333,517
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,obstruction,371,479,119
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,sans famille,576,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,saut_bref,0,14,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,trou,8,10,6
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,avant,2a8d3da,Total,visibilite,458,448,145
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,BREITHORN,deplacement,171,11,11
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,BREITHORN,obstruction,71,41,41
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,BREITHORN,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,BREITHORN,visibilite,0,34,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,cible_a_probleme,571,2433,571
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,deplacement,0,2433,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,deplacement_thermique,504,889,201
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,obstruction,0,191,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,sans famille,576,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,saut_bref,0,14,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,trou,0,4,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,JUNGFRAU,visibilite,47,287,25
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,MICHIGAN,cible_a_probleme,133,132,132
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,MICHIGAN,deplacement,9,1,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,MICHIGAN,deplacement_thermique,135,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,MICHIGAN,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NEBRASKA,cible_a_probleme,133,132,132
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NEBRASKA,deplacement,53,2,1
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NEBRASKA,deplacement_thermique,91,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NEBRASKA,trou,2,2,2
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NEBRASKA,visibilite,10,1,1
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NORDEND,deplacement_thermique,332,318,316
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NORDEND,obstruction,6,83,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NORDEND,trou,2,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,NORDEND,visibilite,111,13,11
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,WILDSTRUBEL,deplacement_thermique,0,126,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,WILDSTRUBEL,obstruction,294,193,107
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,WILDSTRUBEL,visibilite,290,113,108
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,cible_a_probleme,837,2697,835
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,deplacement,233,2447,12
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,deplacement_thermique,1062,1333,517
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,obstruction,371,508,148
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,sans famille,576,0,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,saut_bref,0,14,0
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,trou,8,10,6
|
||||||
|
2026-11-03T13:01Z,2026-11-03T1249Z_NEBRASKA,modification 1,f790519+,Total,visibilite,458,448,145
|
||||||
|
Reference in new issue
Block a user