Covariance-Adaptive Hermite Latent Bottleneck / mini_experiment.py
Mechanism confirmed, baseline not beaten
1import json
2from verify import run
3
4
5def main():
6 out = run()
7 rows = []
8 for r in out['reports']:
9 rows.append({
10 'q': r['q'],
11 'adaptive_degree': r['chosen_degree'],
12 'adaptive_coefficients': r['chosen_coefficients'],
13 'adaptive_actual_relative_tail': r['chosen_tail'],
14 'fixed_degree': 4,
15 'fixed_coefficients': r['fixed_degree_4_coefficients'],
16 'fixed_actual_relative_tail': r['fixed_degree_4_tail'],
17 'coefficient_ratio_adaptive_over_fixed': r['chosen_coefficients'] / r['fixed_degree_4_coefficients'],
18 })
19 result = {
20 'claim_check': {
21 'heat_max_relative_error': out['heat_relative_error'],
22 'envelope_constant_from_exact_quadrature': out['empirical_envelope_C'],
23 'tail_target': out['target'],
24 },
25 'benchmark': rows,
26 'interpretation': 'Exact diagonal-Gaussian density-ratio approximation using Hermite coefficients; fixed degree 4 is the control. Coefficients are distribution-level, not per-sample latent codes.'
27 }
28 with open('mini_result.json', 'w') as f:
29 json.dump(result, f, indent=2)
30 print(json.dumps(result, indent=2))
31
32
33if __name__ == '__main__':
34 main()