nmaher's picture
Add exp6-8 drivers, results JSON, figures, poster, dataset card; drop duplicated root-level code copies
857044b verified
Raw
History Blame Contribute Delete
2.54 kB
"""Control for Claim 3 (Theorem 2): relax the cluster-noise condition.
Theorem 2 asserts that after K*T GD iterations the misclassification error is
uniformly small *across all K tasks*, under sigma = Theta(1/(polylog(d) sqrt d)).
On the prescribed grid (exp3_regime.py, `claim3` block) the measured error is
identically 0 at every one of the 32 configurations, which supports the claim
but has no discriminating power: a broken measurement would look the same.
This control sweeps the one condition Theorem 2 places on the data -- the
cluster noise level sigma = sigma_c / sqrt(d) -- from the paper's sigma_c = 0.1
up to sigma_c = 4.0, holding everything else at the claim-3 base point. If the
audit is measuring what Theorem 2 describes, error must stay at 0 while the
condition holds and rise once it is violated.
Deliberately single-process and small: it runs alongside the exp4/exp5 sweeps
without adding to peak memory.
"""
import json
import os
import sys
import time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import clcore as C # noqa: E402
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "results")
os.makedirs(OUT, exist_ok=True)
D, M, N, K, T, ETA = 50, 1000, 1000, 6, 200, 8.0
SIGMAS = [0.1, 0.25, 0.5, 1.0, 2.0, 4.0]
SEEDS = [0, 1, 2]
if __name__ == "__main__":
t0 = time.time()
recs = []
total = len(SIGMAS) * len(SEEDS)
for i, sc in enumerate(SIGMAS):
for s in SEEDS:
r = C.continual_run(d=D, m=M, K=K, n=N, T=T, eta=ETA,
sigma_c=sc, loss_name="hinge", seed=s,
n_test=2000)
recs.append(dict(
sigma_c=sc, seed=s, d=D, m=M, n=N, K=K, T=T, eta=ETA,
# error of every task k measured at the final iterate w_{K-1}
train_err_end=[float(r["err_at"][K - 1, k]) for k in range(K)],
test_err_end=[float(r["test_err_at"][K - 1, k]) for k in range(K)],
# error of task k right after it was trained (no forgetting yet)
train_err_own=[float(r["err_at"][k, k]) for k in range(K)],
train_loss_end=[float(r["loss_at"][K - 1, k]) for k in range(K)],
))
print(f" {len(recs)}/{total} sigma_c={sc} seed={s} "
f"{time.time() - t0:.0f}s", flush=True)
path = os.path.join(OUT, "exp6_noise.json")
with open(path, "w") as f:
json.dump(recs, f)
print("wrote exp6_noise.json", f"{time.time() - t0:.0f}s", flush=True)