diff options
Diffstat (limited to 'experiments/nuisance_control_sweep.sh')
| -rwxr-xr-x | experiments/nuisance_control_sweep.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/experiments/nuisance_control_sweep.sh b/experiments/nuisance_control_sweep.sh new file mode 100755 index 0000000..ef715f4 --- /dev/null +++ b/experiments/nuisance_control_sweep.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# Three-way residualization control with per-neuron soma-dendrite coupling: +# raw = unmodified apical teaching signal +# matched = raw direction, per-sample norm matched to the innovation +# residual = soma-dendritic innovation +# +# Usage: +# bash experiments/nuisance_control_sweep.sh \ +# <gpu> "<rhos>" "<seeds>" <epochs> <prefix> [pert_mode] [n_dirs] +# +# Example: +# bash experiments/nuisance_control_sweep.sh \ +# 5 "0 0.05 0.2 0.5" "0 1 2" 15 nuis_ctrl simultaneous 16 +set -eu + +cd "$(dirname "$0")/.." +PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3 +GPU="${1:?GPU index required}" +RHOS="${2:-0 0.05 0.2 0.5}" +SEEDS="${3:-0}" +EPOCHS="${4:-15}" +PREFIX="${5:-nuis_ctrl}" +PERT_MODE="${6:-simultaneous}" +N_DIRS="${7:-16}" + +export CUDA_VISIBLE_DEVICES="$GPU" +export OMP_NUM_THREADS=2 +mkdir -p results logs/nuisance + +run_one() { + local rho="$1" + local arm="$2" + local seed="$3" + local residual=0 + local scale_control=none + local rho_tag="${rho//./p}" + local tag="${PREFIX}_rho${rho_tag}_${arm}_s${seed}" + local result="results/${tag}.json" + local log="logs/nuisance/${tag}.log" + if [[ "$arm" == residual ]]; then + residual=1 + elif [[ "$arm" == matched ]]; then + scale_control=match_innovation_norm + fi + if [[ -f "$result" ]]; then + echo "skip $tag (result exists)" + return + fi + echo ">>> $tag $(date --iso-8601=seconds) gpu=$GPU" + "$PY" experiments/run.py \ + --mode sdil --dataset mnist --depth 3 --width 256 --epochs "$EPOCHS" \ + --seed "$seed" --nuis_rho "$rho" --use_residual "$residual" \ + --raw_scale_control "$scale_control" --predictor_mode diagonal \ + --p_warmup_steps 200 --p_warmup_eta 0.05 \ + --pert_mode "$PERT_MODE" --pert_ndirs "$N_DIRS" --log_every 100 \ + --tag "$tag" --outdir results > "$log" 2>&1 + grep -h DONE "$log" +} + +for seed in $SEEDS; do + for rho in $RHOS; do + for arm in raw matched residual; do + run_one "$rho" "$arm" "$seed" + done + done +done |
