Download eval/score.py from mohitkrconnect/heed-voice-notes-to-tasks: direct link, hf CLI and curl.
- Browser
- Download file 3.18 kB
-
https://huggingface.co/datasets/mohitkrconnect/heed-voice-notes-to-tasks/resolve/main/eval/score.py
- Command line
-
hf download hf://datasets/mohitkrconnect/heed-voice-notes-to-tasks/eval/score.py
-
curl -L -o score.py https://huggingface.co/datasets/mohitkrconnect/heed-voice-notes-to-tasks/resolve/main/eval/score.py
3.18 kB
| """Recompute judged task F1 per system from test_answers.jsonl, plus a paired bootstrap against Heed. | |
| python3 score.py # first judge (Gemini 3.1 Pro), all public test notes | |
| python3 score.py --judge gpt # second judge (GPT-5.4), the notes it also judged | |
| Per note and system the judge gave each listed task good / fixable / wrong, and listed what was missed. | |
| precision = good / (good + fixable + wrong) | |
| recall = good / (good + fixable + missed) | |
| F1 is computed on the totals over the notes (micro), using only notes that have a valid verdict for every system. | |
| Paired bootstrap: 4,000 resamples of the notes (seed 0), the same resamples for every system, system F1 minus Heed F1. | |
| No third-party packages. | |
| """ | |
| import argparse | |
| import json | |
| import os | |
| import random | |
| HEED = "heed_qwen3_0.6b_int8_phone" | |
| ORDER = [HEED, "claude_sonnet_5.5_key", "claude_haiku_5.5", "gemini_3.5_flash", "gpt_5.4_mini"] | |
| def counts(verdicts): | |
| items = verdicts["items"] | |
| good = sum(1 for x in items if x["verdict"] == "good") | |
| fix = sum(1 for x in items if x["verdict"] == "fixable") | |
| wrong = sum(1 for x in items if x["verdict"] == "wrong") | |
| return good, fix, wrong, len(verdicts["missed"]) | |
| def f1(rows, ids): | |
| tp = sum(rows[i][0] for i in ids) | |
| listed = sum(rows[i][0] + rows[i][1] + rows[i][2] for i in ids) | |
| want = sum(rows[i][0] + rows[i][1] + rows[i][3] for i in ids) | |
| p, r = tp / max(1, listed), tp / max(1, want) | |
| return 2 * p * r / (p + r) if p + r else 0.0 | |
| def gap(a, b, ids, turns=4000): | |
| rnd = random.Random(0) | |
| d = sorted(f1(a, s) - f1(b, s) for s in ([rnd.choice(ids) for _ in ids] for _ in range(turns))) | |
| return 100 * (f1(a, ids) - f1(b, ids)), 100 * d[int(0.025 * turns)], 100 * d[int(0.975 * turns)] | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--judge", choices=["gemini", "gpt"], default="gemini") | |
| ap.add_argument("--file", default=os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_answers.jsonl")) | |
| args = ap.parse_args() | |
| field = "judge_gemini_3_1_pro" if args.judge == "gemini" else "judge_gpt_5_4" | |
| rows = {k: {} for k in ORDER} | |
| for line in open(args.file, encoding="utf-8"): | |
| r = json.loads(line) | |
| for k in ORDER: | |
| v = r["systems"].get(k, {}).get(field) | |
| if v: | |
| rows[k][r["id"]] = counts(v) | |
| ids = sorted(set.intersection(*[set(v) for v in rows.values()])) | |
| name = "Gemini 3.1 Pro" if args.judge == "gemini" else "GPT-5.4" | |
| print(f"Judge: {name}. {len(ids)} public test notes judged for all five systems. Judged task F1 (%), and system minus Heed [95% interval]") | |
| for k in ORDER: | |
| if k == HEED: | |
| print(f" {k:30s} F1 {100 * f1(rows[k], ids):5.1f}") | |
| else: | |
| g = gap(rows[k], rows[HEED], ids) | |
| print(f" {k:30s} F1 {100 * f1(rows[k], ids):5.1f} minus Heed {g[0]:+5.1f} [{g[1]:+5.1f}, {g[2]:+5.1f}]") | |
| print("Verdict totals (good, fixable, wrong, missed):") | |
| for k in ORDER: | |
| t = [sum(rows[k][i][j] for i in ids) for j in range(4)] | |
| print(f" {k:30s} {tuple(t)}") | |
| if __name__ == "__main__": | |
| main() | |