summaryrefslogtreecommitdiff
path: root/experiments/depth_sweep.sh
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/depth_sweep.sh')
-rw-r--r--experiments/depth_sweep.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/experiments/depth_sweep.sh b/experiments/depth_sweep.sh
new file mode 100644
index 0000000..f7c4112
--- /dev/null
+++ b/experiments/depth_sweep.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# Locate the regime where DFA fails and SDIL survives: deep, UNNORMALISED tanh
+# MLPs. DFA's random feedback loses gradient alignment with depth; SDIL learns
+# the apical pathway per-layer by node perturbation, so alignment should hold.
+# Usage: bash depth_sweep.sh "<datasets>" "<depths>" "<seeds>" <epochs> <tag_prefix>
+set -u
+cd "$(dirname "$0")/.."
+PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3
+export OMP_NUM_THREADS=2
+DATASETS="${1:-mnist fmnist}"
+DEPTHS="${2:-3 5 7 10}"
+SEEDS="${3:-0}"
+EP="${4:-20}"
+PFX="${5:-depth}"
+OUT=results
+LOGS=logs/depth
+mkdir -p "$OUT" "$LOGS"
+PROG="$LOGS/progress.txt"
+echo "=== depth sweep start $(date) datasets=[$DATASETS] depths=[$DEPTHS] seeds=[$SEEDS] ===" >> "$PROG"
+
+run () {
+ local tag="$1"; shift
+ if [ -f "$OUT/$tag.json" ]; then echo "skip $tag" >> "$PROG"; return; fi
+ echo ">>> $tag $(date +%H:%M:%S)" >> "$PROG"
+ $PY experiments/run.py --tag "$tag" --outdir "$OUT" "$@" > "$LOGS/$tag.log" 2>&1 \
+ && grep -h DONE "$LOGS/$tag.log" >> "$PROG" || echo "FAIL $tag" >> "$PROG"
+}
+
+for ds in $DATASETS; do
+ for s in $SEEDS; do
+ for d in $DEPTHS; do
+ for m in bp dfa sdil; do
+ run "${PFX}_${ds}_${m}_d${d}_s${s}" --mode $m --dataset $ds --depth $d \
+ --width 256 --epochs $EP --seed $s --pert_ndirs 8
+ done
+ done
+ done
+done
+echo "=== depth sweep done $(date) ===" >> "$PROG"