下面这个sklearn官方的例子
>>> 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))
precision recall f1-score support
class 0 0.50 1.00 0.67 1
class 1 0.00 0.00 0.00 1
class 2 1.00 0.67 0.80 3
avg / total 0.70 0.60 0.61 5
report里最后一列是support。这个support是什么意思?
1个回答
sklearn官方文档的解释是“The support is the number of occurrences of each class in y_true.”
class I的suppport是k,意思就是说该测试集中有k个样本的真实分类为class i.
所以你上面的表格里class 0 support = 1就是说,测试集里有1个样本的真实标签是class 0.
class 1 support = 1就是说,测试集里有1个样本的真实标签是class 1.
class 2 support = 3就是说,测试集里有3个样本的真实标签是class 2.
相关讨论
怎么自定义sklearn GridSearchCV中评估函数的阈值
关于sklearn.model_selection.PredefinedSplit的用法
sklearn cross_val_score中的参数pre_dispatch
sklearn cross_val_score怎么同时对多个scoring进行验证
sklearn.model_selection.cross_val_predict怎么固定random_state?
随便看看
matplotlib画图怎么确保横坐标和纵坐标的单位长度一致?