如何理解Precision和Recall以及Accuracy?
如何理解Precision和Recall以及Accuracy?
参考资料:
https://zhuanlan.zhihu.com/p/78204581
https://zhuanlan.zhihu.com/p/405658103
https://blog.csdn.net/u014380165/article/details/77493978
import numpy as np
from sklearn.metrics import accuracy_score
y_pred = [2, 1, 1, 0]
y_true = [0, 1, 2, 3]
print(accuracy_score(y_true, y_pred)) # 0.25
print(accuracy_score(y_true, y_pred, normalize=False)) # 1
# 在具有二元标签指示符的多标签分类案例中
print(accuracy_score(np.array([[0,1], [1,1]]), np.ones((2, 2)))) # 0.5