# What is the definition of precision for no positive classifications?

The precision is defined as

$$\text{precision} = \frac{\text{true positive}}{\text{true positive} + \text{false positive}}$$

Is there any definition what this value should be if there is no positive classification (but of course positive elements)?

• So the classifier would predict all negative elements when tested? Whatever the classifier model class, your estimate from a test set would show "this classifier is much the same as guessing negative in all cases". I doubt there is any default other than the arithmetic one where $\frac{0}{0}$ is not defined. – Neil Slater Jul 9 '16 at 19:27
• @NeilSlater Yes, I am talking about a "classifier" which "predicts" always just the most common class (the negative one, in this case). – Martin Thoma Jul 9 '16 at 19:33

I just found that sklearn.metrics.precision_score handles it like this:

>>> sklearn.metrics.precision_score(y_true, y_pred)
/home/moose/.local/lib/python2.7/site-packages/sklearn/metrics/classification.py:1074:
UndefinedMetricWarning: Precision is ill-defined and being
set to 0.0 due to no predicted samples.
'precision', 'predicted', average, warn_for)
0.0


So they give a warning and set it to 0.

I have worked on several practical projects. In these projects we designed classifiers to deal with practical problems. Before I started working on practical I used to be very interested in : overall classification accuracy, sensitivity and specificity. In practical life, usually they care in two values: Positive predictive value " precision " and positive percentage PP "how many samples are predicted as positive". The pp value measures the usefulness of this practical solution while the ppv value measures the quality of your solution. Based on my understanding if the pp value is zero the ppv value is not defined and the solution itself is not valid