计算精度和召回率 [英] Calculate Precision and Recall

查看:121
本文介绍了计算精度和召回率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对于如何使用NB分类器在有监督的机器学习算法中计算精度和召回率感到非常困惑

I am really confused about how to calculate Precision and Recall in Supervised machine learning algorithm using NB classifier

举例说明
1)我有两个班A,B
2)我有10000个文档,其中有2000个要用于培训样本集(A类= 1000,B类= 1000)
3)现在,根据上述训练样本集,使用NB分类器对其余8000个文档进行分类
4)现在,在将5000个文档分类为A类之后,将3000个文档归为B类.
5)现在如何计算精确度和召回率?

Say for example
1) I have two classes A,B
2) I have 10000 Documents out of which 2000 goes to training Sample set (class A=1000,class B=1000)
3) Now on basis of above training sample set classify rest 8000 documents using NB classifier
4) Now after classifying 5000 documents goes to class A and 3000 documents goes to class B
5) Now how to calculate Precision and Recall?

请帮助我.

谢谢

推荐答案

您必须将结果分为四组-
真正的A类(TA)-正确分类为A类
错误的A类(FA)-错误地分类为A类
真实的B级(TB)-正确分类为B级
错误的B级(FB)-错误地分类为B级

Hi you have to divide results into four groups -
True class A (TA) - correctly classified into class A
False class A (FA) - incorrectly classified into class A
True class B (TB) - correctly classified into class B
False class B (FB) - incorrectly classified into class B

精度= TA/(TA + FA)
召回率= TA/(TA + FB)

precision = TA / (TA + FA)
recall = TA / (TA + FB)

您可能还需要准确性和F量度:

You might also need accuracy and F-measure:

精度=(TA + TB)/(TA + TB + FA + FB)
f-measure = 2 *((精度*召回率)/(精度+召回率))

accuracy = (TA + TB) / (TA + TB + FA + FB)
f-measure = 2 * ((precision * recall)/(precision + recall))

更多信息在这里:
http://en.wikipedia.org/wiki/Precision_and_recall#Definition_.28classification_context.29

More here:
http://en.wikipedia.org/wiki/Precision_and_recall#Definition_.28classification_context.29

这篇关于计算精度和召回率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆