【发布时间】:2021-02-22 21:43:24
【问题描述】:
我有一个二元分类,其中一个类的大小几乎是另一个类的 0.1。
我正在使用 sklearn 创建模型并对其进行评估。我正在使用这两个功能:
print(precision_recall_fscore_support(y_real,y_pred))
out:
(array([0.99549296, 0.90222222]), # precision of the first class and the second class
array([0.98770263, 0.96208531]), # recall of the first class and the second class
array([0.99158249, 0.93119266]), # F1 score of the first class and the second class
array([1789, 211])) # instances of the first class and the second class
返回每个类的精度、recal、fscore 和支持
print(precision_score(y_real,y_pred),recall_score(y_real,y_pred))
out:
0.90222222 , 0.96208531 # precsion and recall of the model
返回预测的准确率和召回率。
为什么precsion和recall函数返回的值与具有较少实例的类(这里是具有211个实例的类)完全相同?
【问题讨论】:
-
你们类的标签是什么,少数类的标签是哪一个?
-
0 和 1 是类,1 是少数类@desertnaut
标签: scikit-learn precision precision-recall imbalanced-data