summaryrefslogtreecommitdiff
path: root/experiments/rain_ep_dillavou_s0.sh
blob: 5aa7743c273f10ec3e626b32eb39035978c9c252 (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
#!/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_s0"
mkdir -p "$OUT"
cd "$AUTHOR"

run_cell() {
  local gpu=$1
  local tag=$2
  local beta_policy=$3
  local mode=$4
  local bias_ratio=$5
  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 "$bias_ratio" \
    --dillavou-drift-ratio 0 --predictor-rate 1 \
    --neutral-cadence 1 --epochs 1 --schedule-epochs 100 \
    --train-limit 10000 --test-limit 2000 --batch-size 100 \
    --training-iterations 15 --inference-iterations 60 \
    --evaluation-split train_holdout --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 0 &
run_cell 1 pep_raw_0003 fixed_positive raw 0.003 &
run_cell 2 pep_raw_001 fixed_positive raw 0.01 &
run_cell 3 pep_raw_003 fixed_positive raw 0.03 &
run_cell 4 pep_raw_01 fixed_positive raw 0.1 &
run_cell 5 random_raw_003 random_sign raw 0.03 &
run_cell 6 centered_raw_003 centered raw 0.03 &
run_cell 7 pep_sdil_003 fixed_positive innovation 0.03 &
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")):
    report = json.loads(path.read_text())
    summary[path.stem] = {
        "test_accuracy": report["final"]["test_accuracy"],
        "test_cost": report["final"]["test_cost"],
        "finite": report["final"]["finite"],
        "wall_seconds": report["final"]["wall_seconds"],
        "corrector": report["final"]["corrector"],
    }
(root / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
print(json.dumps(summary, indent=2))
PY