summaryrefslogtreecommitdiff
path: root/experiments/rain_ep_centered_r1.sh
blob: 7f4af27a404b5040e619d5aa444c19ea8134bb6d (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
#!/usr/bin/env bash
set -euo pipefail

ROOT=/home/yurenh2/sdil
AUTHOR=/scratch/yurenh2/energy-based-learning
PYTHON=/scratch/yurenh2/venvs/burstccn/bin/python
PROFILE="$ROOT/results/physical_bias/p0_state_dependence.json"
OUT="$ROOT/results/ep_bias/centered_r1"
mkdir -p "$OUT"
cd "$AUTHOR"

run_cell() {
  local gpu=$1
  local tag=$2
  local mode=$3
  local cadence=$4
  local profile=$5
  local profile_args=()
  if [ "$profile" = released ]; then
    profile_args=(--dillavou-profile-json "$PROFILE")
  fi
  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 centered --beta-value 0.25 \
    --mode "$mode" --bias-ratio 1 --dillavou-drift-ratio 0 \
    "${profile_args[@]}" --predictor-rate 1 \
    --dillavou-calibration-steps 1 --neutral-cadence "$cadence" \
    --epochs 1 --schedule-epochs 100 \
    --train-limit 10000 --test-limit 2000 --batch-size 128 \
    --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 centered_clean clean 0 constant &
run_cell 1 fixed_raw raw 0 constant &
run_cell 2 fixed_intercept constant 0 constant &
run_cell 3 fixed_sdil innovation 0 constant &
run_cell 4 profile_raw raw 0 released &
run_cell 5 profile_intercept_c10 constant 10 released &
run_cell 6 profile_sdil_c10 innovation 10 released &
run_cell 7 profile_oracle oracle 0 released &
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] = {
        "holdout_accuracy": report["final"]["test_accuracy"],
        "finite": report["final"]["finite"],
        "wall_seconds": report["final"]["wall_seconds"],
    }
(root / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
print(json.dumps(summary, indent=2))
PY