sklearn classification_report里的support是什么意思

  统计/机器学习 监督式学习 模型验证 Python    浏览次数:13550        分享
1

下面这个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是什么意思?


 

TheOne   2017-12-14 13:42



   1个回答 
5

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.


SofaSofa数据科学社区DS面试题库 DS面经

Gavin   2017-12-16 12:21



  相关讨论

怎么自定义sklearn GridSearchCV中评估函数的阈值

关于sklearn.model_selection.PredefinedSplit的用法

sklearn计算MAPE

调用sklearn中的classification_report,ValueError: Mix type of y not allowed, got types set(['binary', 'continuous'])

sklearn cross_val_score中的参数pre_dispatch

sklearn cross_val_score怎么同时对多个scoring进行验证

sklearn无法加载kfold

sklearn.model_selection.cross_val_predict怎么固定random_state?

sklearn GridSearchCV中的refit是什么意思

sklearn predict的默认阈值

  随便看看

怎么直观理解ROC AUC的概率统计意义?

matplotlib画图怎么确保横坐标和纵坐标的单位长度一致?

python pandas里有没有类似R的summary的函数?

机器学习基础

随机平均梯度法(Stochasitc Average Gradient)和随机梯度下降(SGD)有什么区别