F1 score

The F1 score is the harmonic mean of precision and recall: 2 x precision x recall / (precision + recall). It equals 1 if both are perfect and drops as soon as one is low. It summarizes both in a single number, which is useful with imbalanced classes where accuracy is misleading.

Example

f1_score(y_test, pred)

Related concepts

The whole glossary