import json import numpy as np from experiment import run rows = [] for alpha in [.01, .05, .1, .2, .4, .8, 1.6, 3.2, 6.4]: x = run(alpha, steps=2500, beta=.2, tau=.2, lam_max=5, batch=16, noisy=True, seed=2346) tail = slice(1500, None) rows.append({ 'alpha': alpha, 'violation_std': float(np.std(x['v'][tail])), 'lambda_std': float(np.std(x['lam'][tail])), 'mean_violation': float(np.mean(x['v'][tail])), 'cap_fraction': float(np.mean(x['lam'][tail] > 4.999)), }) with open('noisy_sweep.json', 'w') as f: json.dump({'seed': 2346, 'steps': 2500, 'tail_start': 1500, 'batch': 16, 'rows': rows}, f, indent=2) print(json.dumps(rows, indent=2))