源自Scikit_Learn Confusion Matrix和Scikit_Learn Recall_Score的灵敏度不匹配

时间:2016-08-05 05:17:08

标签: machine-learning scikit-learn confusion-matrix

tp = cf[0][0]
fn = cf[0][1]
fp = cf[1][0]
tn = cf[1][1]
sensitivity= tp/(tp+fn)
print(sensitivity)

阵列

([[0,2],

[0,2]])

print(sk.metrics.recall_score(true, predict))

0.0

{{1}}

1.0

根据Scikit文档“Demo”定义必须匹配。 有人可以解释一下这个吗?

1 个答案:

答案 0 :(得分:1)

混淆矩阵标签必须按以下方式更新:

tn = cf[0][0]
fp = cf[0][1]
fn = cf[1][0]
tp = cf[1][1]
sensitivity= tp/(tp+fn)
print(sensitivity)

1.0