Precision is defined as the ratio of true positive predictions to the total number of positive predictions made by the model. In simple terms, it tells us how many of the items the model identified as relevant are actually relevant. It’s calculated using the following formula:
$$ \text{Precision} = \frac{\text{True Positives}}{\text{True Positives} + \text{False Positives}} $$
Let’s take a closer look at an example.
Imagine an ecommerce platform that recommends products based on a customer’s past purchases and browsing history. Let’s say a model predicts 50 products as relevant to a specific user, and out of these, 40 products genuinely match the user’s interests (True Positives), while 10 products do not (False Positives).
The precision of this recommendation model would be:
$$ \text{Precision}=\frac{40}{40 + 10}= \frac{40}{50}=0.8(80\%) $$
This means 80% of the recommended products are genuinely relevant to the user’s preferences, giving us an indication of the model’s effectiveness in filtering out irrelevant items.
Precision is often discussed alongside recall. While precision focuses on the accuracy of positive predictions, recall measures how well the model captures all relevant items. Depending on the use case, we may prioritize one over the other:
In many applications, a balance between precision and recall is desired, which is why the F1 score is used. The F1 score is the harmonic mean of precision and recall, providing a single metric that balances both.
Precision is a fundamental metric in machine learning that provides insight into the accuracy of a model’s positive predictions. In domains like ecommerce, precision directly impacts user satisfaction by helping ensure that recommendations are relevant. While it’s not the only metric used to evaluate models, precision is crucial for applications where false positives need to be minimized.