#显示主要分类指标的文本报告
from sklearn.metrics import classification_report
y_true = [0, 1, 2, 2, 2]
y_pred = [0, 0, 2, 2, 1]
target_names = ['class 0', 'class 1', 'class 2']
print(classification_report(y_true, y_pred, target_names=target_names))
#support每个样本出现的次数
#微平均值:micro average,所有数据结果的平均值
#宏平均值:macro average,所有标签结果的平均值
#加权平均值:weighted average,所有标签结果的加权平均值

本文通过一个示例展示了如何使用sklearn库中的classification_report函数来评估分类模型的性能,解释了support、微平均值、宏平均值及加权平均值的概念。
1435

被折叠的 条评论
为什么被折叠?



