Download scripts/study_censoring.py from Gaurav711/HyperFlow: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/scripts/study_censoring.py
- Command line
-
hf download hf://spaces/Gaurav711/HyperFlow/scripts/study_censoring.py
-
curl -L -o study_censoring.py https://huggingface.co/spaces/Gaurav711/HyperFlow/resolve/main/scripts/study_censoring.py
1.38 kB
| #!/usr/bin/env python3 | |
| """Reproduce the controlled censoring study; no provider calls or real sales claims.""" | |
| from pathlib import Path | |
| import argparse | |
| import json | |
| import sys | |
| import time | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from backend.flagship.ml import run_censoring_study | |
| from study_evidence import write_evidence | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--output", type=Path, default=Path(".local/studies/censoring")) | |
| parser.add_argument("--samples", type=int, default=1200) | |
| parser.add_argument("--seeds", type=int, nargs="+", default=[7, 19, 41]) | |
| parser.add_argument("--levels", type=float, nargs="+", default=[.2, .4, .6]) | |
| parser.add_argument("--evidence-output", type=Path, help="Write measured runtime, source hashes, and complete results") | |
| args = parser.parse_args() | |
| started = time.perf_counter() | |
| result = run_censoring_study(args.output, seeds=args.seeds, levels=args.levels, n_samples=args.samples) | |
| elapsed = time.perf_counter() - started | |
| if args.evidence_output: | |
| write_evidence(args.evidence_output, study="censoring", result=result, elapsed_seconds=elapsed) | |
| print(json.dumps(result, indent=2, allow_nan=False)) | |
| return 0 if all(run["converged"] for run in result["runs"]) else 1 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |