如何理解Precision和Recall?
如何理解Precision和Recall?
Precision ,在预测结果中,正确预测了多少?P可以联想到pedict,预测;
Recall,在真实样本中,正确预测了多少?R可以联想到real,真实;
F1值,就是综合考虑了precision和recall
F1 = 2*precision*recall/(precision+recall)
如何翻译这两个词?---> 准确率和召回率 <---
如何拓展到多分类问题上?
1、宏平均的方案,即分别计算每一类的precision和recall;
2、另外一种,我不理解,感觉意义不大。
--------------------------------------------
Python如何计算多类的Precision和Recall,以及F1值?
from sklearn.metrics import accuracy_score,precision_score, recall_score, f1_score import numpy as np y_true = np.array([],dtype='int64') y_pred = np.array([],dtype='int64')
accuracy = accuracy_score(y_true, y_predict) precision = precision_score(y_true, y_predict, average='macro') recall = recall_score(y_true, y_predict, average='macro') f1 = f1_score(y_true, y_predict, average='macro')
print("accuracy is {}, Precision is {}, Recall is {} and F1 is {}".format(accuracy, precision, recall, f1))
多分类ROC曲线的绘制没有没有必要?