AsianPlayer/TriDrive / code /eval /run_warning_head_final_gzfc.sh
AsianPlayer's picture
download
raw
5.5 kB
#!/usr/bin/env bash
# cwm3/eval/run_warning_head_final_gzfc.sh — OPTIONAL step 4 of the gaze-chain appendix variant (2026-09-13; run only because the pre-registered rule of
# stage_final_gzfc.md passed): the learned warning head ON THE VARIANT `I1_all_minus_road2drv_s<k>_final_gzfc`, CPU only, mirroring eval/run_warning_head_gaze.sh.
# bash eval/run_warning_head_final_gzfc.sh ["0 1 2"] [n_boot_train=1000] [n_boot_eval=2000]
# Per seed k: (1) eval/gaze_rows_from_joint.py — the variant's OWN (fine-tuned) gaze_off chain on the 979 TRAIN label rows -> pred_gaze_*_train_labelrows.npz in the
# variant dir (the joint layouts already carry the gaze block for test / val); (2) train/train_warning_head.py --run <variant> --demand P --feature-sets current
# --extra-features dwell,face --w-suffix _dwfc (the cur+dwell+face REFERENCE on the variant; label-free current-state features, so it should coincide with the
# frozen model's `_dwfc` head) and --extra-features dwell,face,gaze --gaze-run <variant> --w-suffix _dwfcgz (same device-grouped 5-fold CV / hp grid / labels);
# (3) eval/merge_w_layouts.py _dwfc + _dwfcgz -> _gzmerged. Then ONE warning_gold item `cwm3_final_gzfc` (unchanged cwm2/eval/warning_gold.py via
# eval/warning_head_eval.py, 509 gold rows), the per-regime report with the PRE-STATED gaze kill rule (adopt only if the paired AUROC delta vs cur+dwell+face has a CI
# excl. 0 on >= 2/3 seeds in engaged OR pooled) and the equal-load operating points -> results/tables/warning_head_final_gzfc.md. Memory gate: MemAvailable >= 18 GB
# before every step. Idempotent. Every gaze row inherits the "gaze validation pending" status (no human gaze label yet).
set -u
cd "$(dirname "$0")/.."
PY=python
export OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
SEEDS="${1:-0 1 2}"; NBT="${2:-1000}"; NBE="${3:-2000}"
gate() { until [ "$(awk '/MemAvailable/{print int($2/1024/1024)}' /proc/meminfo)" -ge 18 ]; do echo "[$(date +%H:%M:%S)] memory gate closed"; sleep 30; done; }
have_w() { for d in $(ls -d results/warning_head/$1_* 2>/dev/null); do $PY -c "import json,sys; d=json.load(open('$d/selected.json')); sys.exit(0 if d.get('w_suffix')=='$2' else 1)" 2>/dev/null && return 0; done; return 1; }
RUNS=()
for s in $SEEDS; do
R=I1_all_minus_road2drv_s${s}_final_gzfc; RUNS+=("$R")
[[ -f results/runs/$R/PRED_DONE && -f results/runs/$R/label_rows.npz ]] || { echo "skip seed $s ($R unfinished)"; continue; }
gate; $PY eval/gaze_rows_from_joint.py --run $R 2>&1 | grep -E "wrote|have|Error|Traceback" | cut -c1-160
if have_w "$R" "_dwfc"; then echo "have warning head _dwfc for $R"; else
gate; echo "[$(date +%H:%M:%S)] == train_warning_head $R (+dwell,face) reference"
$PY train/train_warning_head.py --run "$R" --demand P --n-boot "$NBT" --feature-sets current --extra-features dwell,face --w-suffix _dwfc 2>&1 | grep -E "DONE|Error|Traceback|File \"|selected|gold clean_test AUROC|train labels" | cut -c1-220
fi
if have_w "$R" "_dwfcgz"; then echo "have warning head _dwfcgz for $R"; else
gate; echo "[$(date +%H:%M:%S)] == train_warning_head $R (+dwell,face,gaze from the variant's own chain)"
$PY train/train_warning_head.py --run "$R" --demand P --n-boot "$NBT" --feature-sets current --extra-features dwell,face,gaze --gaze-run "$R" --w-suffix _dwfcgz 2>&1 | grep -E "DONE|Error|Traceback|File \"|selected|gold clean_test AUROC|gaze run|train labels" | cut -c1-220
fi
[[ -f results/runs/W_${R}_dwfc/pred_layout_manual_test.npz && -f results/runs/W_${R}_dwfcgz/pred_layout_manual_test.npz ]] || { echo "W layouts missing for $R"; continue; }
$PY eval/merge_w_layouts.py --run "$R" --suffixes _dwfc _dwfcgz --out-suffix _gzmerged 2>&1 | grep -E "wrote|have|Error|Traceback" | cut -c1-160
done
COL=W_learned_curhgb_t15_w10_n979dwfcgz; REF=W_learned_curhgb_t15_w10_n979dwfc
gate; echo "[$(date +%H:%M:%S)] == warning_head_eval --item cwm3_final_gzfc"
$PY eval/warning_head_eval.py --runs "${RUNS[@]}" --item cwm3_final_gzfc --n-boot "$NBE" --w-suffix _gzmerged --dir-suffixes _dwfc _dwfcgz --headline $COL --out-name warning_head_final_gzfc.md \
--feature-label "current + dwell + face (reference head trained on the variant) vs + gaze block from the VARIANT's own fine-tuned gaze_off chain — GAZE VALIDATION PENDING applies to every gaze row" 2>&1 | grep -E "Verdict|B4|B5|written|Error|Traceback|File \"" | head -20
gate; echo "[$(date +%H:%M:%S)] == regime report"
$PY eval/warning_head_regime_report.py --item cwm3_final_gzfc --cols $REF $COL W_learned_cursel_t15_w10_n979dwfc W_learned_cursel_t15_w10_n979dwfcgz \
--pairs "gaze_beyond_dwell_face:${COL}-${REF}" --ensemble-cols $COL $REF --n-boot "$NBE" --out results/tables/warning_head_final_gzfc.md \
--title "Warning head on the gaze-chain APPENDIX variant (I1_all_minus_road2drv_s<k>_final_gzfc): cur+dwell+face+gaze (the variant's own chain) vs the cur+dwell+face reference — per-regime strata, paired effect, 3-seed ensemble — GAZE VALIDATION PENDING" 2>&1 | grep -E "appended|written|Error|Traceback|File \"" | head
gate; echo "[$(date +%H:%M:%S)] == operating points"
WR=(); for s in $SEEDS; do WR+=("W_I1_all_minus_road2drv_s${s}_final_gzfc_dwfcgz"); done
$PY eval/operating_points.py --item final_gzfc_dwfcgz --w-runs "${WR[@]}" --seeds $SEEDS --col $COL --label "HGB(current+dwell+face+gaze; variant chain)" --loads dms_matched,same_recall,low10 --n-boot "$NBT" 2>&1 | grep -E "appended|written|Error|Traceback|File \"|EQUAL|verdict" | head
echo WH_GZFC_DONE

Xet Storage Details

Size:
5.5 kB
·
Xet hash:
21dbe7244c7358dacd0090668a8b896cc50bf18249162465ddfe25e96c29db37

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