F1 Value In Classification
We’re getting somewhere with our modelling evaluation! We’ve covered a variety of helpful techniques, that are all part of the toolkit when we want to assess our machine learning model fit and performance.
We’re going to build on our previous values of Precision and Recall, and combine them for a very useful optimising value!
The F1 value.
So… What is F1?
Technically speaking, the F1 value is the harmonic mean of precision and recall. What does that actually mean?
We’ve covered precision and recall already, and now we want to combine them.
So: F1 is precision multiplied by recall, divided by the sum of precision and recall, all multiplied by 2.
What does it mean?
The simplest way to think about F1 is that it’s a balancing metric. Previously, we covered the possibility that one of precision or recall could be way more important when we’re modelling. Whilst that can be the case, there is always a trade-off. The F1 value is a way to view the balance of precision and recall overall.
How do I understand it?
A great way to think about F1 is in the extreme cases.
A value of 1 represents perfect recall, and perfect precision.
A value of 0 represents no recall and no precision.
Why don’t I just use Accuracy then?
Good question. The thing about modelling in practice, is that true negatives can overwhelm the accuracy and make us think that our model is fantastic.
Unfortunately, we tend to want to try and predict rare events, and false negatives and false positives can be very costly in the use of our models.
F1 can be a better measure to use when there is an uneven class balance (distribution of 0s and 1s, in the binary case).
So, we now have a toolkit of some relatively basic, but incredibly insightful metrics and techniques that we can use to assess the performance of our classification models.
If you want to learn more about classification methods, we have a series of blog posts discussing the theory, advantages and disadvantages, and introduction to implementation of a range of techniques.
If you have any questions, leave a comment. If you have any suggestions for articles you’d like, leave a comment. If you want to write for us, let us know!