Download source/scripts/score_aw1.py from ajinkyamulay/analyst-workbench: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/datasets/ajinkyamulay/analyst-workbench/resolve/main/source/scripts/score_aw1.py
- Command line
-
hf download hf://datasets/ajinkyamulay/analyst-workbench/source/scripts/score_aw1.py
-
curl -L -o score_aw1.py https://huggingface.co/datasets/ajinkyamulay/analyst-workbench/resolve/main/source/scripts/score_aw1.py
1.33 kB
| """Score AW-1 by its pre-registered rule (P1: >= 12 of 24 mixed groups; P2: 0.2 <= mean <= 0.8).""" | |
| import collections | |
| import json | |
| import sys | |
| rows = [json.loads(line) for line in open(sys.argv[1])] | |
| ok = [r for r in rows if r.get("reward") is not None] | |
| by = collections.defaultdict(list) | |
| for r in ok: | |
| by[r["task_id"]].append(r) | |
| mixed = 0 | |
| for task, rs in by.items(): | |
| rewards = [r["reward"] for r in rs] | |
| is_mixed = len(set(rewards)) > 1 | |
| mixed += is_mixed | |
| ends = dict(collections.Counter(r["end"] for r in rs)) | |
| acts = sum(r["actions"] for r in rs) / len(rs) | |
| print(f"{task:24s} {[round(x, 2) for x in rewards]} mean={sum(rewards) / len(rewards):.2f} " | |
| f"{'MIXED' if is_mixed else ' '} acts={acts:.1f} {ends}") | |
| mean = sum(r["reward"] for r in ok) / len(ok) | |
| turns = sum(r["actions"] for r in ok) | |
| print(f"episodes {len(rows)}, infrastructure errors {len(rows) - len(ok)}") | |
| print(f"P1 mixed groups {mixed} of {len(by)} -> {'confirmed' if mixed >= 12 else 'refuted'}") | |
| print(f"P2 mean reward {mean:.3f} -> {'confirmed' if 0.2 <= mean <= 0.8 else 'refuted'}") | |
| print("ends", dict(collections.Counter(r["end"] for r in ok))) | |
| print(f"fenced replies {sum(r.get('fenced', 0) for r in ok)} of {turns}; mean actions {turns / len(ok):.2f}") | |
| print(f"wall seconds {sum(r['seconds'] for r in rows):.0f}") | |