July 2017
Intermediate to advanced
254 pages
6h 29m
English
The F1 measure is the harmonic mean of the precision and recall scores. The F1 measure penalizes classifiers with imbalanced precision and recall scores, like the trivial classifier that always predicts the positive class. A model with perfect precision and recall scores will achieve an F1 score of 1. A model with a perfect precision score and a recall score of 0 will achieve an F1 score of 0. Let's compute our classifier's F1 score:
# In[3]:f1s = cross_val_score(classifier, X_train, y_train, cv=5, scoring='f1')print('F1 score: %s' % np.mean(f1s))# Out[3]:F1 score: 0.809067846627
Models are sometimes evaluated using the F0.5 and F2 scores, which bias precision over recall and recall over precision, respectively. ...
Read now
Unlock full access