Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Aggregate multi-run evaluation report for SYNAPSE-X. | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| from statistics import mean, stdev | |
| PROJECT_ROOT = Path(__file__).resolve().parents[1] | |
| if str(PROJECT_ROOT) not in sys.path: | |
| sys.path.insert(0, str(PROJECT_ROOT)) | |
| from scripts.inference import run_episode | |
| def evaluate(level: str, runs: int = 20, start_seed: int = 42): | |
| scores = [run_episode(level, seed=start_seed + idx, verbose=False) for idx in range(runs)] | |
| return { | |
| "mean": round(mean(scores), 4), | |
| "std": round(stdev(scores) if len(scores) > 1 else 0.0, 4), | |
| "min": round(min(scores), 4), | |
| "max": round(max(scores), 4), | |
| } | |
| def main(): | |
| report = {} | |
| for level in ["easy", "medium", "hard"]: | |
| stats = evaluate(level, runs=20) | |
| report[level] = stats | |
| print(f"{level}: {stats}") | |
| with open(PROJECT_ROOT / "report_results.json", "w", encoding="utf-8") as handle: | |
| json.dump(report, handle, indent=2) | |
| if __name__ == "__main__": | |
| main() | |