Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
613 views
in Technique[技术] by (71.8m points)

machine learning - Calculate Precision and Recall

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

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?

Please help me..

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

You might also need accuracy and F-measure:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...