AsianPlayer/TriDrive / code /eval /run_k4_evals.sh
AsianPlayer's picture
download
raw
3.67 kB
#!/usr/bin/env bash
# cwm3/eval/run_k4_evals.sh — K4 (claim B1) evaluation of the causal-kinematics U0 runs (docs/k4_handoff.md), CPU.
# bash eval/run_k4_evals.sh "0 1 2"
# For each seed k and regime:
# (a) all rows: U0_kin_can_noK_s<k>_kcv1 vs U0_kin_can_noK_s<k> (non-causal ROI) on identical rows — driver populations from the OLD cwm2 kin
# targets (tag K4_s<k>_causal_vs_noK) AND from the CAUSAL targets (tag K4c_s<k>_causal_vs_noK; the two target sets disagree on
# hand events, decisions 2026-09-10 QC row);
# (b) masked: U0_kin_can_noK_s<k>_kcv1_masked vs the non-causal run, both restricted to the non-suspect routes (--mask-routes), old and
# causal targets (tags K4m_s<k>_causalm_vs_noK, K4cm_s<k>_causalm_vs_noK).
# B1 vs persistence / k0_heuristic: eval_grid (unchanged) with --baselines on the old targets, item cwm3_k4 (eval/eval_cwm3.py).
# Then eval/report_joint.py renders results/tables/k4.md. Idempotent on the paired_compare tags.
set -u
cd "$(dirname "$0")/.."
PY=python
export OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
MASK=results/targets_kin_causal_routes/driver_box_suspect_routes.json
have_tag() { grep -q ",$1,$2,test," results/paired_compare.csv 2>/dev/null; }
for s in ${1:-0 1 2}; do
A=results/runs/U0_kin_can_noK_s${s}_kcv1; AM=results/runs/U0_kin_can_noK_s${s}_kcv1_masked; B=results/runs/U0_kin_can_noK_s${s}
for reg in manual engaged; do
if [[ -f $A/PRED_DONE && -f $B/PRED_DONE ]]; then
have_tag "K4_s${s}_causal_vs_noK" $reg || $PY eval/paired_compare_joint.py --regime $reg --a $A --b $B --tag K4_s${s}_causal_vs_noK 2>&1 | grep -E "appended|Error|Traceback"
have_tag "K4c_s${s}_causal_vs_noK" $reg || $PY eval/paired_compare_joint.py --regime $reg --a $A --b $B --tag K4c_s${s}_causal_vs_noK --kin-targets causal_routes 2>&1 | grep -E "appended|Error|Traceback"
else echo "skip K4 s$s $reg (runs not finished)"; fi
if [[ -f $AM/PRED_DONE && -f $B/PRED_DONE ]]; then
have_tag "K4m_s${s}_causalm_vs_noK" $reg || $PY eval/paired_compare_joint.py --regime $reg --a $AM --b $B --tag K4m_s${s}_causalm_vs_noK --mask-routes $MASK 2>&1 | grep -E "appended|Error|Traceback"
have_tag "K4cm_s${s}_causalm_vs_noK" $reg || $PY eval/paired_compare_joint.py --regime $reg --a $AM --b $B --tag K4cm_s${s}_causalm_vs_noK --kin-targets causal_routes --mask-routes $MASK 2>&1 | grep -E "appended|Error|Traceback"
else echo "skip K4m s$s $reg (runs not finished)"; fi
done
done
# B1 reference rows (persistence / k0 on the old targets) for every finished causal run
for reg in manual engaged; do
runs=""; for s in ${1:-0 1 2}; do for d in U0_kin_can_noK_s${s}_kcv1 U0_kin_can_noK_s${s}_kcv1_masked; do [[ -f results/runs/$d/PRED_DONE ]] && runs="$runs $d"; done; done
[[ -n "$runs" ]] && $PY eval/eval_cwm3.py --item cwm3_k4 --regime $reg --runs $runs --cells drv_onset,hazard_nll --n-boot 1000 --workers 6 2>&1 | grep -E "appended|Error|Traceback"
done
$PY eval/report_joint.py --stage K4 --a causal --b noK --claim B2 --seeds ${1// /,} --out results/tables/k4_old_targets.md 2>&1 | grep -E "written|Claim"
$PY eval/report_joint.py --stage K4m --a causalm --b noK --claim B2 --seeds ${1// /,} --out results/tables/k4_old_targets_masked.md 2>&1 | grep -E "written|Claim"
$PY eval/report_joint.py --stage K4c --a causal --b noK --claim B2 --seeds ${1// /,} --out results/tables/k4_causal_targets.md 2>&1 | grep -E "written|Claim"
$PY eval/report_joint.py --stage K4cm --a causalm --b noK --claim B2 --seeds ${1// /,} --out results/tables/k4_causal_targets_masked.md 2>&1 | grep -E "written|Claim"
echo K4_EVALS_DONE

Xet Storage Details

Size:
3.67 kB
·
Xet hash:
5e2a2cbc436b20df46452d39beb51703f3390f43de4af1b17f2fc4fc857f6955

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.