Normal-Space Quotient Encoder / multiseed.py

Mechanism confirmed, baseline not beaten

Raw ⬇ ZIP
 1import json
 2from experiment import train, evaluate, device, orbit_tangent, projector, make_data
 3import torch
 4
 5def cond_stats():
 6    x,_=make_data(2000,909)
 7    R=orbit_tangent(x).unsqueeze(-1)
 8    # damped Gram condition, including singular points at the origin
 9    gram=R.transpose(1,2)@R + 1e-6*torch.eye(1)
10    vals=gram[:,0,0]
11    return {'min_damped_gram_eigenvalue':float(vals.min()),'max_damped_gram_eigenvalue':float(vals.max()),'condition_number':float(vals.max()/vals.min())}
12
13rows=[]
14for seed in [17,29,41]:
15    b=evaluate(train(False,seed,350),seed+1000)
16    q=evaluate(train(True,seed,350),seed+1000)
17    rows.append({'seed':seed,'baseline':b,'idea':q,'drift_ratio':q[2]/b[2]})
18out={'device':device,'runs':rows,'conditioning':cond_stats()}
19print(json.dumps(out,indent=2))
20with open('multiseed_results.json','w') as f: json.dump(out,f,indent=2)