#!/usr/bin/env bash
# G2 (ACC_EXPERIMENT_PLAN.md section 7): DirectNet sw2 with a LONGER CAUSAL window (past context only: the window
# still ends 0.75 s after the decision time, lookahead_s 0.75 as for 10 s). Exactly the recipe of runners/run_m1_seed.sh clf
# with --window-s W: SparrKULee pretrain (the time-weight vector depends on W, so the 10-s pretrain cannot be reused)
# -> LODO sw2 (5 folds) -> all-five model + AASD / Carta evidence.
# Usage: runners/run_g2_window.sh W SEED      (W = 15 or 20)
set -euo pipefail
cd "$(dirname "$0")/.."
w="${1:?window s}"; seed="${2:?seed}"
py=../../.venv/bin/python
prep=eaP_n5_t60
sfx=$([ "$seed" = 0 ] && echo "" || echo "_s${seed}")
init="models/pretrain_spk_direct_clf_w${w}_b3_s${seed}.pt"
[ -f "$init" ] || GLIMPSE_THR=onorm "$py" -u direct_classifier.py --window-s "$w" --pretrain-spk --tag "_w${w}_b3" \
  --train-seed "$seed" --min-epochs 25 --max-epochs 80 --set model_blocks=3
GLIMPSE_THR=onorm "$py" -u direct_classifier.py --prep "$prep" --window-s "$w" --set model_blocks=3 \
  --init-from "$init" --min-epochs 10 --train-seed "$seed" --p-switch 0.5 --aug-set clf_p_switch2=0.5 \
  --tag "_w${w}b3_ptSPK${sfx}_aug-sw2"
GLIMPSE_THR=norm "$py" -u eval_external_clf.py --seed "$seed" --prep "$prep" --window-s "$w" --set model_blocks=3 \
  --p-switch 0.5 --aug-set clf_p_switch2=0.5 --init-from "$init" \
  --ref "direct_clf__${prep}_w${w}b3_ptSPK${sfx}_aug-sw2" --tag "_w${w}b3sw2P"
echo "G2 window $w seed $seed done"
