def evaluate(path):
true = [int(pair[1] is None or gold[pair]) for pair in resources[path]]
pred = [int(pair[1] is not None) for pair in resources[path]]
tn, fp, fn, tp = confusion_matrix(true, pred).ravel()
return {
'tn': tn,
'fp': fp,
'fn': fn,
'tp': tp,
'precision': precision_score(true, pred),
'recall': recall_score(true, pred),
'f1': f1_score(true, pred),
'scores': scores(resources[path])
}
评论列表
文章目录