# F1 Score

## What Does F1 Score Mean?

An F1 score is a metric used in machine learning (ML) to evaluate how accurately a binary classification model classifies new input, taking both precision and recall metrics into account.

Precision measures how often the model is correct when it predicts a positive instance.

Recall measures how well the model is able to find all the positive instances in a dataset.

F1 scores combine these two metrics to create a single score that represents the overall accuracy of the model.

F1 scores are often used to compare the performance of different models or to optimize the hyperparameters of a single model. F1 scores range from 0 to 1. The higher score, the more accurate the outputs.

## Techopedia Explains F1 Score

Mathematically, F1 scores represent the harmonic mean of precision and recall.

Harmonic mean is a type of average that’s used when the values that are being averaged are ratios. It is calculated by taking the reciprocal of each value, finding their average and then using the reciprocal of that average as the mean. This formula puts more weight on smaller values, so if one of the values that is being averaged is extremely low, the harmonic mean will also be low.

Using the harmonic mean to determine the accuracy of a binary classification model ensures that the impact of such low values will be appropriately reflected in the overall score.

## The Usefulness of F1 Scores

F1 scores are particularly useful when one class in the data set that’s used to train the model has significantly more instances than the other class.

F1 scores are often used to evaluate binary classification models designed to:

• Classify emails as either being spam or not spam.
• Classify medical images as being either positive or negative for a specific condition.
• Classify loan applications as either being high or low risk.
• Classify financial transactions as being either fraudulent or non-fraudulent.
• Classify text data as being either positive or negative in sentiment.  