如何理解Precision和Recall以及Accuracy?

如何理解Precision和Recall以及Accuracy?

https://blog.csdn.net/Hodors/article/details/120635079?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166697727816782425115343%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166697727816782425115343&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-5-120635079-null-null.article_score_rank_blog&utm_term=accuracy

参考资料:

https://zhuanlan.zhihu.com/p/78204581

https://zhuanlan.zhihu.com/p/405658103

https://blog.csdn.net/u014380165/article/details/77493978

image-20221029012254418

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
posted @ 2022-10-31 16:52  bH1pJ  阅读(12)  评论(0编辑  收藏  举报