在 PyML 中获取多类问题的召回率(灵敏度)和精度 (PPV) 值
我使用 PyML 进行 SVM 分类。但是,我注意到,当我使用 LOO 评估多类分类器时,结果对象不会报告灵敏度和 PPV 值。相反,它们是 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 am using PyML for SVM classification. However, I noticed that when I evaluate a multi-class classifier using LOO, the results object does not report the sensitivity and PPV values. Instead they are 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法在多类问题上获得通常的精度/召回率测量。您必须获得每个类别的精确度/召回率,并且可以计算加权平均值。
我不知道 PyML 的具体情况,但您可以查看预测并计算每个类别的预测。
You cannot get the usual Precision/Recall measurements on a multi-class problem. You have to get Precision/Recall for each class, and you can compute a weighted average.
I don't know about the specifics of PyML, but you can just go through the predictions and calculate them for each class.
对于多类敏感性计算,您可以使用 scikit-learn 指标 API。
例如,如果
Y
有 4 个类,则结果将是一个包含每个类的敏感度的数组。For multiclass sensitivity calculation, you can use scikit-learn metrics API.
For instance, if
Y
has 4 classes, the result will be an array with the sensitivity of each one.