← Lesson
Eval the Judge
Joeven
Run
Reset
Python loads on first run
def pr(pred, gold): tp = sum(1 for p, g in zip(pred, gold) if p and g) fp = sum(1 for p, g in zip(pred, gold) if p and not g) fn = sum(1 for p, g in zip(pred, gold) if (not p) and g) prec = tp / (tp + fp) if (tp + fp) else 0.0 rec = tp / (tp + fn) if (tp + fn) else 0.0 return {"tp": tp, "fp": fp, "fn": fn, "prec": prec, "rec": rec} gold = [True, True, False, False, True] judge = [True, False, False, True, True] print(pr(judge, gold)) print("fn is missed fails — that is the scary number")
Run to execute this in your browser. Nothing is sent to a server.