diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-07 12:57:59 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-07 12:57:59 -0500 |
| commit | 138955f8365bc3086de8b8ff3b7f36f48070f602 (patch) | |
| tree | 36115e1344949e127250b7d7a9a248af1527a7d4 /experiments/rain_ep_dillavou_s0b.sh | |
| parent | e824fc9ec147fc7b94b5493bc96e7a7127a33c01 (diff) | |
exp: freeze expanded Dillavou bias screen
Diffstat (limited to 'experiments/rain_ep_dillavou_s0b.sh')
| -rwxr-xr-x | experiments/rain_ep_dillavou_s0b.sh | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/experiments/rain_ep_dillavou_s0b.sh b/experiments/rain_ep_dillavou_s0b.sh new file mode 100755 index 0000000..712dd07 --- /dev/null +++ b/experiments/rain_ep_dillavou_s0b.sh @@ -0,0 +1,105 @@ +#!/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_s0b" +mkdir -p "$OUT" +cd "$AUTHOR" + +run_cell() { + local gpu=$1 + local tag=$2 + local beta_policy=$3 + local beta_value=$4 + local mode=$5 + local bias_ratio=$6 + 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 "$beta_value" \ + --mode "$mode" --bias-ratio "$bias_ratio" \ + --dillavou-drift-ratio 0 --predictor-rate 1 \ + --dillavou-calibration-steps 1 --neutral-cadence 0 \ + --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 +} + +# Wave 1: select the smallest fixed offset causing at least ten accuracy points +# of damage relative to clean positive EP. This is development-only selection. +run_cell 0 pep_clean fixed_positive 0.25 clean 0 & +run_cell 1 pep_raw_03 fixed_positive 0.25 raw 0.3 & +run_cell 2 pep_raw_1 fixed_positive 0.25 raw 1 & +run_cell 3 pep_raw_3 fixed_positive 0.25 raw 3 & +run_cell 4 pep_raw_10 fixed_positive 0.25 raw 10 & +run_cell 5 random_clean random_sign 0.25 clean 0 & +run_cell 6 centered_clean centered 0.25 clean 0 & +run_cell 7 pep_sdil_3 fixed_positive 0.25 innovation 3 & +wait + +selected=$("$PYTHON" - "$OUT" <<'PY' +import json +from pathlib import Path +import sys + +root = Path(sys.argv[1]) +clean = json.loads((root / "pep_clean.json").read_text())["final"]["test_accuracy"] +candidates = [(0.3, "03"), (1.0, "1"), (3.0, "3"), (10.0, "10")] +rows = [] +selected = candidates[-1][0] +for ratio, tag in candidates: + final = json.loads((root / f"pep_raw_{tag}.json").read_text())["final"] + rows.append({"ratio": ratio, "accuracy": final["test_accuracy"], + "finite": final["finite"]}) + if final["finite"] and final["test_accuracy"] <= clean - 0.10: + selected = ratio + break +(root / "selector.json").write_text(json.dumps({ + "rule": "smallest ratio with >=0.10 accuracy damage and finite parameters", + "clean_accuracy": clean, + "candidates": rows, + "selected_ratio": selected, +}, indent=2) + "\n") +print(selected) +PY +) + +# Wave 2: test beta centering, the two local calibrators, an oracle, and larger +# beta values at the selected hardware-offset magnitude. +run_cell 0 pep_constant_selected fixed_positive 0.25 constant "$selected" & +run_cell 1 pep_sdil_selected fixed_positive 0.25 innovation "$selected" & +run_cell 2 pep_oracle_selected fixed_positive 0.25 oracle "$selected" & +run_cell 3 random_raw_selected random_sign 0.25 raw "$selected" & +run_cell 4 centered_raw_selected centered 0.25 raw "$selected" & +run_cell 5 pep_raw_beta05 fixed_positive 0.5 raw "$selected" & +run_cell 6 pep_raw_beta1 fixed_positive 1.0 raw "$selected" & +run_cell 7 pep_raw_beta2 fixed_positive 2.0 raw "$selected" & +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 in {"selector.json", "summary.json"}: + continue + 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 |
