多分类的 准确率 召回率 代码
原创
©著作权归作者所有:来自51CTO博客作者TechOnly的原创作品,请联系作者获取转载授权,否则将追究法律责任
from sklearn.metrics import classification_report,confusion_matrix
# 准确率 召回率 F1 每个类的数据量
precision_recall_report = classification_report(
y_true=all_groundtruth_list,
y_pred=all_predict_list,
labels=list(range(0,len(all_label_list))),
target_names=all_label_list)
print(precision_recall_report)
# 混淆矩阵
matrix = confusion_matrix(
y_true=all_groundtruth_list,
y_pred=all_predict_list,
labels=list(range(0,len(all_label_list))))
print(matrix)