diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-10 04:35:14 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-08-10 04:35:14 -0500 |
| commit | 82a31439f67a0a7d3143f9d3703e63932887fd69 (patch) | |
| tree | 49088a110dce16f1f607aa348d9db69b136f64ce /experiments/rain_ep_upfront_ols_r7.sh | |
| parent | b99dcc466da5de1b634e92f8fd48664b1a1b4f20 (diff) | |
exp: confirm four-probe SDIL across seeds
Diffstat (limited to 'experiments/rain_ep_upfront_ols_r7.sh')
| -rwxr-xr-x | experiments/rain_ep_upfront_ols_r7.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/experiments/rain_ep_upfront_ols_r7.sh b/experiments/rain_ep_upfront_ols_r7.sh new file mode 100755 index 0000000..96b0c06 --- /dev/null +++ b/experiments/rain_ep_upfront_ols_r7.sh @@ -0,0 +1,69 @@ +#!/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_r7_ols_seeds" +mkdir -p "$OUT" +cd "$AUTHOR" + +run_cell() { + local gpu=$1 + local seed=$2 + local mode=$3 + local predictor_kind=$4 + local tag=$5 + 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-profile-json "$PROFILE" --predictor-rate 1 \ + --predictor-kind "$predictor_kind" \ + --dillavou-calibration-steps 4 --neutral-cadence 0 \ + --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 "$seed" --beta-seed 7100 --deterministic \ + --output "$OUT/$tag.json" > "$OUT/$tag.log" 2>&1 +} + +seeds=(1988 1989 1990 1991) +gpu=0 +for seed in "${seeds[@]}"; do + run_cell "$gpu" "$seed" constant nlms "seed_${seed}_intercept" & + gpu=$((gpu + 1)) + run_cell "$gpu" "$seed" innovation ols "seed_${seed}_sdil" & + gpu=$((gpu + 1)) +done +wait + +"$PYTHON" - "$OUT" <<'PY' +import json +from pathlib import Path +import statistics +import sys + +root = Path(sys.argv[1]) +by_seed = {} +for path in sorted(root.glob("seed_*.json")): + _, seed, method = path.stem.split("_", 2) + report = json.loads(path.read_text()) + by_seed.setdefault(seed, {})[method] = report["final"]["test_accuracy"] +for seed, values in by_seed.items(): + values["sdil_minus_intercept"] = values["sdil"] - values["intercept"] +summary = {"by_seed": by_seed} +for key in ("intercept", "sdil", "sdil_minus_intercept"): + values = [row[key] for row in by_seed.values()] + summary[key] = { + "mean": statistics.mean(values), + "sample_std": statistics.stdev(values), + "values": values, + } +(root / "summary.json").write_text(json.dumps(summary, indent=2) + "\n") +print(json.dumps(summary, indent=2)) +PY |
