# How to calculate precision and recall when some of the test data remains unclassified

Consider a situation where we are running a classifier (the actual classification algorithm doesn't matter here), and the class labels are given based on a score. If score > 0, the data point is labeled A, if score < 0, the data point is labeled B.

All the training data contains data points with positive or negative scores. However, in my test data, there are a few points that return score = 0. How should I measure the precision and recall in this scenario where some points can't be classified into any class?

[additional information from a comment below] I faced this in a sentiment classification task. The normalized scores are in the range [-1,1], with 0 being the score for documents with no sentiment. It so happened that I had no neutral documents in my training data, but in the test data, some documents returned a score of 0.

## migrated from stackoverflow.comJul 23 '12 at 12:34

This question came from our site for professional and enthusiast programmers.

• Doesn't that simply mean that points with score = 0 are not counted in the set of retrieved items? en.wikipedia.org/wiki/… – Mr E Jul 20 '12 at 15:51
• In the classification context, I don't think we can say that items are retrieved. We need to think in terms of true-positive, false-positive, true-negative and false-negative. And once I get score = 0, I am not sure what it means in terms of these four categories. – Chthonic Project Jul 20 '12 at 16:10
• Either you have to decide for adding another label C which is unclassified or you have to use a default label, say A. But that is dependend on your domain knowledge. not that you classify people where you're unsure to have cancer ;) – Thomas Jungblut Jul 21 '12 at 6:37
• What does score "0" actually mean ? In default classification algorithms I know, there is no score zero. If the scores are generated by some sort of function, the probability of hitting one single real valued score is 0. So gaining a single score a significantly more often than once either means a dataset of "manageable complexity" or some explictly implemented special behavior. Which is ? – steffen Jul 24 '12 at 7:11
• No problem, feel free to accept Michael McGowans answer ;) The main point is that I helped you, not the reputation. – Thomas Jungblut Jul 24 '12 at 8:41