Commit
P6: directional accuracy undefined (NaN) for zero-location models; economics re-run chain
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
added
scripts/review/batch_N1i.sh
+10 −0
@@ -0,0 +1,10 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# N1i = M3U96b: P6 economics re-run after the dir_acc fix (zero-location models reported as NaN), four tags. | |
| 3 | +set -e; cd ~/wp41_uqo | |
| 4 | +export OMP_NUM_THREADS=4; ulimit -n 65536 | |
| 5 | +PY="nice -n 10 .venv/bin/python" | |
| 6 | +for exp_tag in "main test" "main test_heldout" "final final" "final final_heldout"; do | |
| 7 | + set -- $exp_tag | |
| 8 | + bash scripts/review/ledger.sh "P6_economic_$2_v2" "$PY scripts/economic.py --exp $1 --tag $2 --models all --delay 1" | |
| 9 | +done | |
| 10 | +echo "[N1i] done" | |
modified
src/chronos_x/eval/economic.py
+4 −1
@@ -32,7 +32,10 @@ def dir_acc_stats(dir_hit: np.ndarray, realised: np.ndarray, meta: pd.DataFrame, | ||
| 32 | 32 | """Directional accuracy over origins with a non-zero realised return, with a day-cluster CI and the cluster-t of |
| 33 | 33 | (dir_acc - 0.5).""" |
| 34 | 34 | nz = realised != 0 |
| 35 | + if not np.any(dir_hit[nz] > 0): # zero-location models (random walk, HAR, GARCH, EWMA, seasonal): no direction is forecast | |
| 36 | + return {"dir_acc": float("nan"), "lo": float("nan"), "hi": float("nan"), "se_cl": float("nan"), "t_cl_vs_half": float("nan"), | |
| 37 | + "n": int(nz.sum()), "n_days": int(meta["session_date"].nunique()), "note": "no location forecast (mu = 0)"} | |
| 35 | 38 | cl = pd.factorize(meta["session_date"])[0][nz] |
| 36 | 39 | cb = cluster_bootstrap_mean(dir_hit[nz].astype(float), cl, n_boot=n_boot) |
| 37 | 40 | return {"dir_acc": cb["mean"], "lo": cb["lo"], "hi": cb["hi"], "se_cl": cb["se"], "t_cl_vs_half": (cb["mean"] - 0.5) / max(cb["se"], 1e-300), |
| 38 | − "n": int(nz.sum()), "n_days": cb["n_clusters"]} | |
| 41 | + "n": int(nz.sum()), "n_days": cb["n_clusters"], "note": ""} | |
| 39 | 42 | |