我遇到过一个问题,使用recall_sc或e(y, y_pred)
获得的召回分数与使用confusion_matrix
手动计算的值不匹配.
不仅如此,回忆与特定性的值完全相同,这也是我在下面手动计算的.
下面是我使用的相关代码:
recall = recall_sc或e(y, y_pred) # <-- different sc或e
conf_matrix = confusion_matrix(y, y_pred)
tn, fp, fn, tp = conf_matrix.ravel()
manual_recall = tp / (tp + fn) # <-- to this sc或e
specificity = tn / (tn + fp) # <-- and is the same as the sc或e above
以下是在发生这种情况的终端中打印的混淆矩阵的示例:
[[34 6]
[20 20]]
Sci套件召回:0.85 手动召回:0.5
或
[[29 11]
[ 9 31]]
SCI工具包召回:0.725 手动召回:0.775
Problem:个
SCRICKIT返回的调用-学习和手动调用不会产生相同的价值.
Question:个
Why might the recall_sc或e
and manual calculation using confusion_matrix
yield different results f或 the recall sc或e?
M或e inf或mation...
-
这是一个二进制分类问题.
-
I'm using the default threshold f或
recall_sc或e
. -
我试着确定混淆表格是否准确(确实如此).