File size: 751 Bytes
67ebcef
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""Paired flip count on the mini set (same items, same sampling seeds): wrong->right vs right->wrong per task."""
import json, sys, collections
def load(t):
    return {g["id"]: (g["task"], g["correct"]) for g in map(json.loads, open(f"results/{t}/graded.jsonl", encoding="utf-8"))}
a, b = load(sys.argv[1]), load(sys.argv[2])
c = collections.defaultdict(lambda: [0, 0, 0])
for i in a:
    if i in b:
        t = "code" if a[i][0].startswith("code") else a[i][0]
        c[t][0] += (not a[i][1]) and b[i][1]; c[t][1] += a[i][1] and not b[i][1]; c[t][2] += 1
tot = [sum(v[k] for v in c.values()) for k in range(3)]
for t, v in sorted(c.items()) + [("ALL", tot)]:
    print(f"{t:8s} n={v[2]:3d}  gained {v[0]:2d}  lost {v[1]:2d}  net {v[0] - v[1]:+d}")