File size: 770 Bytes
a1fe2e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3
"""HARD dev proxy: 290 en_dev2 positives with the lowest en17 peak. Misses on HARD (and total) per TAG@THR.
    python hard_eval.py TAG:THR [TAG:THR ...]"""
import sys
import numpy as np
sys.path.insert(0, __import__("os").path.dirname(__file__)); import vf_score as V


def peaks(tag):
    z = V.load(tag); out = []
    for d, e in zip(z["pos"], z["pos_end"]):
        t, tm = V.track(d, 110); m = (tm >= e) & (tm <= e + 1.0); out.append(t[m].max() if m.any() else 0.0)
    return np.array(out)


H = np.argsort(peaks("en17"), kind="stable")[:290]
for a in sys.argv[1:]:
    tag, thr = a.split(":"); p = peaks(tag); thr = float(thr)
    print(f"{tag}@{thr}: HARD miss {(p[H] < thr).sum()}/290, total miss {(p < thr).sum()}/{len(p)}", flush=True)