F-score :
F-score is a metric used to evaluate the performance of a model in classification tasks. It is a weighted average of precision and recall, where precision is the number of true positives divided by the sum of true positives and false positives, and recall is the number of true positives divided by the sum of true positives and false negatives. The F-score is calculated using the following formula:
F-score = (1 + beta^2) * (precision * recall) / (beta^2 * precision + recall)
where beta is a parameter that weights the importance of precision and recall. In most cases, beta is set to 1, which means that precision and recall are equally important. However, in some cases, you may want to give more weight to precision or recall, depending on the specific requirements of your application.
To illustrate how F-score is calculated, let’s use a simple example. Suppose you have a model that is trained to classify images of cats and dogs. The model is tested on a dataset that contains 100 images, where 50 are of cats and 50 are of dogs. The model correctly identifies 40 cat images and 30 dog images. The confusion matrix for this example is shown below:
Actual Cat Actual Dog
Predicted Cat 40 10
Predicted Dog 20 30
Based on this confusion matrix, we can calculate the precision and recall for each class:
Precision for cats: 40 / (40 + 20) = 0.67
Recall for cats: 40 / (40 + 10) = 0.80
Precision for dogs: 30 / (30 + 20) = 0.60
Recall for dogs: 30 / (30 + 10) = 0.75
Using these values, we can now calculate the F-score for each class using the formula above:
F-score for cats: (1 + 1^2) * (0.67 * 0.80) / (1^2 * 0.67 + 0.80) = 0.73
F-score for dogs: (1 + 1^2) * (0.60 * 0.75) / (1^2 * 0.60 + 0.75) = 0.68
Overall, the F-score for this model is 0.71, which indicates that the model performed well in classifying both cats and dogs.
In conclusion, F-score is a useful metric for evaluating the performance of a classification model. It takes into account both precision and recall, which are important measures of accuracy in classification tasks. By weighing precision and recall equally, F-score provides a balanced evaluation of a model’s performance.