Buckets:
| """CLAIM 5, supplement -- the d-exponent measured at a FIXED aspect ratio T/d. | |
| In the main script d is swept at a fixed horizon T = 4000, so T/d falls from 1000 to 125 and | |
| the envelope/sqrt(dT) ratio drifts upward (0.54 -> 0.80); the fitted d-exponent (0.69) is | |
| biased by that drift. Theorem 5.2 assumes T >= 4d, and sqrt(dT) is the rate in the regime | |
| T >> d. Sweeping d with T = 500 d holds the aspect ratio fixed, and then sqrt(dT) = sqrt(500)*d, | |
| so the predicted exponent in d is 1. | |
| """ | |
| from __future__ import annotations | |
| import json | |
| import os | |
| import sys | |
| import numpy as np | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from batch import fit_exponent | |
| from claim5_lowerbound import ALGS, SEED, theorem_floor | |
| def main(seeds=12): | |
| rows = [] | |
| for d in [4, 8, 16, 32]: | |
| T = 500 * d | |
| sigma = 1.0 / np.sqrt(2 * d) | |
| env = np.inf | |
| per = {} | |
| for name, fn in ALGS.items(): | |
| worst = -np.inf | |
| for c in [0.5, 1.0, 2.0]: | |
| Delta = c / np.sqrt(T) | |
| vals = [] | |
| for s in range(seeds): | |
| rng = np.random.default_rng(SEED + 31 * s + d + int(10 * c)) | |
| theta = (rng.integers(2, size=d) * 2.0 - 1.0) * Delta | |
| vals.append(fn(T, d, theta, sigma, rng)) | |
| worst = max(worst, float(np.mean(vals))) | |
| per[name] = worst | |
| env = min(env, worst) | |
| rows.append( | |
| dict( | |
| d=d, | |
| T=T, | |
| aspect_ratio=T / d, | |
| per_algorithm=per, | |
| empirical_minimax_envelope=env, | |
| sqrt_dT=float(np.sqrt(d * T)), | |
| envelope_over_sqrt_dT=env / float(np.sqrt(d * T)), | |
| theorem_floor=float(theorem_floor(d, T)), | |
| above_theorem_floor=bool(env >= theorem_floor(d, T)), | |
| ) | |
| ) | |
| sl, _, se = fit_exponent( | |
| [r["d"] for r in rows], [r["empirical_minimax_envelope"] for r in rows] | |
| ) | |
| res = dict( | |
| claim="claim-5 supplement: d-exponent at fixed aspect ratio T = 500 d", | |
| seed=SEED, | |
| seeds=seeds, | |
| rows=rows, | |
| fitted_d_exponent=sl, | |
| stderr=se, | |
| predicted=1.0, | |
| note="at T = 500 d, sqrt(dT) = sqrt(500) d, so a sqrt(dT) rate shows up as a " | |
| "d-exponent of 1", | |
| ) | |
| out = os.path.join( | |
| os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | |
| "outputs", | |
| "claim5_supplement.json", | |
| ) | |
| with open(out, "w") as f: | |
| json.dump(res, f, indent=1) | |
| print(json.dumps(res, indent=1)) | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 2.66 kB
- Xet hash:
- 39b5312a07bfdc52e769956bbb54aac21e33f31d140dc7eaaecf3cc0efe0bfc8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.