Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
Tags:
mathematics
information-theory
renyi-entropy
shannon-entropy
hidden-markov-models
bernoulli-convolutions
Download examples/make_certificates.py from PureOne/VELORYN-Boundary-Kernel-Entropy: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/datasets/PureOne/VELORYN-Boundary-Kernel-Entropy/resolve/main/examples/make_certificates.py
- Command line
-
hf download hf://datasets/PureOne/VELORYN-Boundary-Kernel-Entropy/examples/make_certificates.py
-
curl -L -o make_certificates.py https://huggingface.co/datasets/PureOne/VELORYN-Boundary-Kernel-Entropy/resolve/main/examples/make_certificates.py
1.88 kB
| """Generate exact certificate examples; timings are local observations, not benchmarks.""" | |
| from pathlib import Path | |
| import json | |
| import sys | |
| import time | |
| sys.path.insert(0,str(Path(__file__).resolve().parents[1])) | |
| from veloryn.examples import fair,markov,variable,hidden,mixture,correlated | |
| from veloryn.entropy import renyi_interval,shannon_interval | |
| from veloryn.numerics import serializable | |
| ROOT=Path(__file__).resolve().parents[1] | |
| results=[] | |
| cases=[('phi_fair_q2',fair(),128,2),('phi_markov_q2',markov(),128,2), | |
| ('salem_fair_q2',fair('salem'),64,2),('salem_markov_q2',markov('salem'),64,2), | |
| ('salem_fair_q3',fair('salem'),16,3), | |
| ('variable_phi_q2',variable(),24,2),('hidden_clock_q2',hidden(),16,2), | |
| ('mixture_cusp_q2',mixture(),16,2), | |
| ('salem_correlated_q2',correlated('salem'),64,2), | |
| ('phi_correlated_q2',correlated(),128,2)] | |
| for name,source,n,q in cases: | |
| started=time.perf_counter() | |
| result=renyi_interval(source,n,q) | |
| elapsed=time.perf_counter()-started | |
| record={'name':name,'certificate':result,'elapsed_seconds_observed':elapsed} | |
| results.append(record) | |
| print(name,elapsed,[float(x) for x in result['interval_nats_per_branch']], | |
| result['diagnostics']['max_layer_states'],flush=True) | |
| (ROOT/'evidence'/f'{name}.json').write_text(json.dumps(serializable(record),indent=2)+'\n') | |
| # The seed is deliberately labelled: no empirical coverage claim is made. | |
| started=time.perf_counter() | |
| source=variable() | |
| shannon=shannon_interval(source,12,128,seed=20261001) | |
| results.append({'name':'variable_shannon_demo','certificate':shannon, | |
| 'elapsed_seconds_observed':time.perf_counter()-started}) | |
| (ROOT/'evidence'/'example_certificates.json').write_text(json.dumps(serializable(results),indent=2)+'\n') | |
| print('shannon demo',shannon['sampling_mode'],[float(x) for x in shannon['interval_nats_per_branch']]) | |