F1 Score

The F1 Score, also called the F score or F measure, is a measure of a test’s accuracy.

F1 Score refers to a metric that balances Precision and Recall. F1 Score combines the two metrics i.e. Precision and Recall of a model into one.

The F1 score is defined as the weighted harmonic mean of the test’s precision and recall. This score is calculated according to the formula.

F1 score

For example:

Let us assume that you developed an AI model that tests pooled specimen(blood/urine etc.) to diagnose some ailment (say covid). After its training with sample collection of specimens whose accurate results were known to you, post testing, you are now ready to evaluate your AI model. For your AI model, you conduct about 630 tests and the confusion matrix with these 630 tests results looked like:

Confusion matrix for AI model

SOLUTION

As per the problem, to find F1-score, we need to calculate Precision and Recall.

To find precision,

precision

Thus, the Precision rate for our sample AI model is 0.64706

To compute Recall,

Confusion matrix for AI model

Thus, the Recall for our sample AI model is 68.75 % or 0.6875.

Here, We got the values of Precision and Recall for the model. Now, we caculate the F1-score as -

Confusion matrix for AI model

Thus, the F1-score for our sample AI model is 0.666666.
In an ideal situation, both Precision and Recall will be 100 % i.e. value of 1.