The criterion: stations seen, cut in time; M1's regressions station by station; no regression when nothing is flagged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-16 17:59:06 +01:00
1 parent f93cdf3cd1
commit 975ebc7c1a
4 files changed
+10 -4

No files matched your search

+5 -1
View File
@@ -49,7 +49,7 @@ def fit(x, y, w=None):
def split_time(a, data, rows, families):
"""Every station seen in training: does the information lie in the features, apart from moving to a new station?"""
from evaluate import counts, show, total
from evaluate import counts, regressions, show, total
cut = {s: int(0.7 * len(r)) for s, r in rows.items()}
x = np.concatenate([rows[s][:cut[s]] for s in data])
base, new = {}, {}
@@ -66,6 +66,10 @@ def split_time(a, data, rows, families):
base[s] = counts(y, np.load(Path(a.cache) / "rules" / f"{s}.npz")["yhat"][cut[s]:])
new[s] = counts(y, yhat[s])
keep = lambda c: {f: v for f, v in c.items() if f in families} # noqa: E731
for s in data:
for f, name, pb, pn in regressions(keep(base[s]), keep(new[s])):
print(f" regression: {s}, {f}, {name} {pb:.0f} % -> {'—' if pn is None else f'{pn:.0f} %'}"
f" (rules {base[s][f]}, model {new[s].get(f)}: labelled, flagged, both)")
show("Last 30 % of every station", keep(total(base)), keep(total(new)))