Spaces:
Sleeping
Sleeping
File size: 1,059 Bytes
cb330aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/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()
|