参考:Evaluation Metrics For Multi-class Classification(Micro-, Macro- 计算)
参考:多分类模型Accuracy, Precision, Recall和F1-score的超级无敌深入探讨
参考:二分类和多分类问题下的评价指标详析(Precision, Recall, F1,Micro,Macro)
参考:详解多分类模型的Macro-F1/Precision/Recall计算过程
代码:
from sklearn.metrics import f1_score, precision_score, recall_score
y_true=[1,2,3]
y_pred=[1,1,3]
f1 = f1_score( y_true, y_pred, average='macro' )
p = precision_score(y_true, y_pred, average='macro')
r = recall_score(y_true, y_pred, average='macro')
print(f1, p, r)
# output: 0.555555555556 0.5 0.666666666667
标签:f1,747,pred,模型,分类,Precision,metrics,score,true From: https://www.cnblogs.com/alex-bn-lee/p/16773587.html