Download code/make_parameter_table.py from ai4he/supervisory-capacity-model: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/ai4he/supervisory-capacity-model/resolve/main/code/make_parameter_table.py
- Command line
-
hf download hf://datasets/ai4he/supervisory-capacity-model/code/make_parameter_table.py
-
curl -L -o make_parameter_table.py https://huggingface.co/datasets/ai4he/supervisory-capacity-model/resolve/main/code/make_parameter_table.py
1.03 kB
| #!/usr/bin/env python3 | |
| """Writes simulation_parameters_table.tex from capacity_parameters.json.""" | |
| import json | |
| from pathlib import Path | |
| P = json.loads(Path("capacity_parameters.json").read_text()) | |
| f = lambda r, k: f"{r[k]:.2f} [{r[k+'_ci'][0]:.2f}, {r[k+'_ci'][1]:.2f}]" | |
| rows = [("Logistic control", "4.35 (true)", P["direct_control"]), | |
| ("Additive", "4.35", P["additive"]), | |
| ("Correlated", "4.35 (naive)", P["correlated"]), | |
| ("Batched", "4.35 (naive)", P["batched"]), | |
| ("Switching", "4.35 (naive)", P["switching"])] | |
| out = [r"\begin{tabular}{lccccc}", r"\toprule", | |
| r"Condition & nominal $n_0$ & fitted $n_{\mathrm{mid}}$ & width $\tau$ & floor $\mathrm{SC}_{\min}$ & ceiling $\mathrm{SC}_{\max}$ \\", | |
| r"\midrule"] | |
| for name, n0, r in rows: | |
| out.append(f"{name} & {n0} & {f(r,'midpoint')} & {f(r,'tau')} & {f(r,'floor')} & {f(r,'ceiling')} \\\\") | |
| out += [r"\bottomrule", r"\end{tabular}"] | |
| Path("simulation_parameters_table.tex").write_text("\n".join(out) + "\n") | |
| print("\n".join(out)) | |