P4-metric
The P4 metric
enables performance evaluation of a binary classifier.
The P4 metric is calculated from precision, recall, specificity, and Positive and negative predictive values#Negative [predictive value (NPV)|NPV].
The definition of the P4 metric is similar to that of the F1 metric, however the P4 metric definition addresses criticisms leveled against the definition of the F1 metric. The definition of the P4 metric may, therefore, be understood as an extension of the F1 metric.
Like the other known metrics, the P4 metric is a function of: TP, TN, FP, FN.
Justification
The key concept of the P4 metric is to leverage the four key conditional probabilities:- — the probability that the sample is positive, provided the classifier result was positive.
- — the probability that the classifier result will be positive, provided the sample is positive.
- — the probability that the classifier result will be negative, provided the sample is negative.
- — the probability the sample is negative, provided the classifier result was negative.
Definition
P4 is defined as a harmonic mean of four key conditional probabilities:In terms of TP,TN,FP,FN it can be calculated as follows:
Evaluation of the binary classifier performance
Evaluating the performance of binary classifiers is a multidisciplinary concept. It spans from the evaluation of medical tests, psychiatric tests to machine learning classifiers from a variety of fields. Thus, many of the metrics in use exist under several names, some defined independently.Properties of P4 metric
- Symmetry — contrasting to the F1 metric, P4 is symmetrical. It means - it does not change its value when dataset labeling is changed - positives named negatives and negatives named positives.
- Range:.
- Achieving requires all the key four conditional probabilities being close to 1.
- For it is sufficient that one of the key four conditional probabilities is close to 0.
Examples, comparing with the other metrics
Dependency table for selected metrics :| P4 | true | true | true | true |
| F1 | true | true | false | false |
| Informedness | false | true | true | false |
| Markedness | true | false | false | true |
Metrics that do not depend on a given probability are prone to misrepresentation when the probability approaches 0.
Example 1: Rare disease detection test
Let us consider a medical test used to detect a rare disease. Suppose a population size of 100000 and 0.05% of the population is infected. Further suppose the following test performance: 95% of all positive individuals are classified correctly and 95% of all negative individuals are classified correctly.In such a case, due to high population imbalance and in spite of having high test accuracy, the probability that an individual who has been classified as positive is in fact positive is very low:
We can observe how this low probability is reflected in some of the metrics:
- ,
- ,
- ,
- .
Example 2: Image recognition — cats vs dogs
Consider the problem of training a neural network based image classifier with only two types of images: those containing dogs and those containing cats. Thus, the goal is to distinguish between the cats and dogs. Suppose that the classifier overpredicts in favour of cats : 99.99% of cats are classified correctly and only 1% of dogs are classified correctly. Further, suppose that the image dataset consists of 100000 images, 90% of which are pictures of cats and 10% are pictures of dogs. In this situation, the probability that the picture containing dog will be classified correctly is pretty low:Not all metrics are notice this low probability:
- ,
- ,
- ,
- .