"""Control detection and agreement with two automatic silver source judges.""" import argparse,collections,json from pathlib import Path ROOT=Path(__file__).resolve().parent/'miriad_public/minicheck_development_calibration_v1' def read(p):return [json.loads(x) for x in p.read_text().splitlines()] if p.exists() else [] def stats(pairs): cells=collections.Counter((int(y),int(p)) for y,p,s in pairs);positives=sum(y==1 for y,p,s in pairs);negatives=sum(y==0 for y,p,s in pairs) sensitivity=cells[1,1]/positives if positives else None;specificity=cells[0,0]/negatives if negatives else None # Rank-based AUROC with tie averaging; against SILVER labels, not medical truth. rank_sum=0.;ordered=sorted(pairs,key=lambda x:x[2]);offset=0 while offset