简体   繁体   English

在 PyML 中获取多类问题的召回(灵敏度)和精度(PPV)值

[英]Get recall (sensitivity) and precision (PPV) values of a multi-class problem in PyML

I am using PyML for SVM classification.我正在使用PyML进行 SVM 分类。 However, I noticed that when I evaluate a multi-class classifier using LOO, the results object does not report the sensitivity and PPV values.但是,我注意到当我使用 LOO 评估多类分类器时,结果对象不会报告灵敏度和 PPV 值。 Instead they are 0.0:相反,它们是 0.0:

from PyML import *
from PyML.classifiers import multi

mc = multi.OneAgainstRest(SVM())
data = VectorDataSet('iris.data', labelsColumn=-1)
result = mc.loo(data)

result.getSuccessRate()
>>> 0.95333333333333337
result.getPPV()
>>> 0.0
result.getSensitivity()
>>> 0.0

I have looked at the code but couldn't figure out what is going wrong here.我查看了代码,但无法弄清楚这里出了什么问题。 Has somebody a workaround for this?有人有解决方法吗?

You cannot get the usual Precision/Recall measurements on a multi-class problem.对于多类问题,您无法获得通常的 Precision/Recall 测量值。 You have to get Precision/Recall for each class, and you can compute a weighted average.您必须获得每个类别的 Precision/Recall,并且您可以计算加权平均值。

I don't know about the specifics of PyML, but you can just go through the predictions and calculate them for each class.我不知道 PyML 的细节,但你可以通过预测并为每个类计算它们。

For multiclass sensitivity calculation, you can use scikit-learn metrics API .对于多类敏感性计算,您可以使用scikit-learn 指标 API

Notice average=None for sensitivity of each class independently.注意每个类别独立的敏感性average=None

sklearn.metrics.recall_score(Y_true,Y_prediction,average=None)

For instance, if Y has 4 classes, the result will be an array with the sensitivity of each one.例如,如果Y有 4 个类,结果将是一个具有每个类的敏感度的数组。

array([0.96629213, 0.86263736, 0.81920904, 0.7704918])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 对多类问题执行 K 折交叉验证,评分 = 'f1 or Recall or Precision' - performing K-fold Cross Validation with scoring = 'f1 or Recall or Precision' for multi-class problem python - 为不同的多类分类器绘制精度召回曲线 - python - Plot Precision Recall Curve for different multi-class classifiers sklearn:多类问题和报告敏感性和特异性 - sklearn: multi-class problem and reporting sensitivity and specificity 如何使用交叉验证在多类数据集中对精度、召回率和 f1-score 进行评分? - how to score precision, recall and f1-score in a multi-class dataset using cross-validate? Tensorflow 中多类分类的分类精度和召回率? - Class wise precision and recall for multi class classification in Tensorflow? 多类的 SHAP 值解释 - SHAP values interpretation for multi-class 计算精度和召回率问题 - Problem with calculation Precision and Recall 如何获得多类分类问题中每个类的精度分数? - How to get the precision score of every class in a Multi class Classification Problem? 通过 Class 计算精度和召回率 - Calculating Precision and Recall by Class 访问 pandas dataframe 跨越多类时遇到问题 - Got problem to access pandas dataframe acrossing multi-class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM