Download scripts/summarize_uq_threshold_sweep.py from BeliefLens/FinGovBench: direct link, hf CLI and curl.
- Browser
- Download file 1.85 kB
-
https://huggingface.co/datasets/BeliefLens/FinGovBench/resolve/main/scripts/summarize_uq_threshold_sweep.py
- Command line
-
hf download hf://datasets/BeliefLens/FinGovBench/scripts/summarize_uq_threshold_sweep.py
-
curl -L -o summarize_uq_threshold_sweep.py https://huggingface.co/datasets/BeliefLens/FinGovBench/resolve/main/scripts/summarize_uq_threshold_sweep.py
1.85 kB
| #!/usr/bin/env python3 | |
| """Summarize the prespecified FinGovBench uncertainty-threshold sweep.""" | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| SWEEP = ROOT / "results/uq_threshold_sweep" | |
| def main() -> None: | |
| rows = [] | |
| for path in sorted(SWEEP.glob("t[0-9][0-9][0-9].json")): | |
| threshold = int(path.stem[1:]) / 100 | |
| report = json.loads(path.read_text()) | |
| for method in ("flat_uq", "sseg"): | |
| point = report["methods"][method]["all"]["point"] | |
| rows.append( | |
| { | |
| "threshold": threshold, | |
| "method": method, | |
| "unsafe_case_release_rate": point["unsafe_case_release_rate"], | |
| "safe_release_recall": point["safe_release_recall"], | |
| "release_rate": point["release_rate"], | |
| "review_fraction": point["review_fraction"], | |
| "exact_scope_accuracy": point["exact_scope"], | |
| "complete_safe_loop_rate": point["safe_loop"], | |
| } | |
| ) | |
| output = { | |
| "benchmark_version": "1.0.0-rc4", | |
| "model": "meta-llama/Llama-3.3-70B-Instruct-Turbo", | |
| "cases": 3000, | |
| "interpretation": ( | |
| "The same saved component-risk scores are converted to governance alarms at " | |
| "each threshold. This measures whether continuous scores support a tunable " | |
| "risk/release frontier. It is not a matched ablation of model probabilities " | |
| "because the lexical baseline uses a different detector." | |
| ), | |
| "rows": rows, | |
| } | |
| destination = SWEEP / "summary.json" | |
| destination.write_text(json.dumps(output, indent=2, sort_keys=True) + "\n") | |
| print(destination) | |
| if __name__ == "__main__": | |
| main() | |