我想将人工计算的精度和召回率与scikit学习函数进行比较。然而,scikit学习函数的recall_score()
和precision_score()
给了我不同的结果。不知道为什么!你能给我一些建议为什么我会得到不同的结果吗?谢谢
我的困惑矩阵:
tp, fn, fp, tn = confusion_matrix(y_test, y_test_pred).ravel()
print('Outcome values : \n', tp, fn, fp, tn)
Outcome values :
3636933 34156 127 151
FDR=tp/(tp+fn) # TPR/Recall/Sensitivity
print('Recall: %.3f' % FDR)
Recall: 0.991
precision=tp/(tp + fp)
print('Precision: %.3f' % precision)
Precision: 1.000
precision = precision_score(y_test, y_test_pred)
print('Precision: %f' % precision)
recall = recall_score(y_test, y_test_pred)
print('Recall: %f' % recall)
Precision: 0.004401
Recall: 0.543165
它应该是(检查返回值的顺序):
请参阅:here
相关问题 更多 >
编程相关推荐