April 2019
Intermediate to advanced
426 pages
11h 13m
English
The F1 score, or F-measure, is the weighted average of the precision score and the recall score, and can be written as follows:

This gives an F1 score between 0 and 1. When either the precision score or the recall score is 0, the F1 score will be 0. However, when both the precision score and recall score are positive, the F1 score gives equal weights to both measures. Maximizing the F1 score creates a balanced classification model with optimal balance of recall and precision.
The f1_score function of the sklearn.metrics module calculates this score for us with the following code:
In [ ]: from sklearn.metrics import f1_score print('f1_score:', ...Read now
Unlock full access