summaryrefslogtreecommitdiff
path: root/experiments/rain_ep_dillavou_c0.sh
blob: f3c088d0d377c3e5861a67831a2f87ba4b1d3840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -euo pipefail

ROOT=/home/yurenh2/sdil
AUTHOR=/scratch/yurenh2/energy-based-learning
PYTHON=/scratch/yurenh2/venvs/burstccn/bin/python
OUT="$ROOT/results/ep_bias/dillavou_c0"
mkdir -p "$OUT"
cd "$AUTHOR"

run_cell() {
  local gpu=$1
  local tag=$2
  local beta_policy=$3
  local mode=$4
  CUBLAS_WORKSPACE_CONFIG=:4096:8 CUDA_VISIBLE_DEVICES="$gpu" "$PYTHON" \
    "$ROOT/experiments/rain_ep_bias_train.py" \
    --author-root "$AUTHOR" --device cuda \
    --adapter dillavou --network-protocol comparative32 \
    --beta-policy "$beta_policy" --beta-value 0.25 \
    --mode "$mode" --bias-ratio 1 \
    --dillavou-drift-ratio 0 --predictor-rate 1 \
    --dillavou-calibration-steps 1 --neutral-cadence 0 \
    --epochs 10 --schedule-epochs 100 \
    --train-limit 60000 --test-limit 10000 --batch-size 128 \
    --training-iterations 15 --inference-iterations 60 \
    --evaluation-split test --data-seed 6200 \
    --seed 1988 --beta-seed 7100 --deterministic \
    --output "$OUT/$tag.json" > "$OUT/$tag.log" 2>&1
}

run_cell 0 pep_clean fixed_positive clean &
run_cell 1 pep_raw fixed_positive raw &
run_cell 2 pep_constant fixed_positive constant &
run_cell 3 pep_sdil fixed_positive innovation &
run_cell 4 random_clean random_sign clean &
run_cell 5 random_raw random_sign raw &
run_cell 6 centered_clean centered clean &
run_cell 7 centered_raw centered raw &
wait

"$PYTHON" - "$OUT" <<'PY'
import json
from pathlib import Path
import sys

root = Path(sys.argv[1])
summary = {}
for path in sorted(root.glob("*.json")):
    if path.name == "summary.json":
        continue
    report = json.loads(path.read_text())
    summary[path.stem] = {
        "trajectory": [
            {
                "epoch": row["epoch"],
                "test_accuracy": row["test_accuracy"],
                "test_cost": row["test_cost"],
                "finite": row["finite"],
            }
            for row in report["metrics"]
        ],
        "final": report["final"],
    }
(root / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
print(json.dumps(summary, indent=2))
PY