Skip to main content

F-score measure

Classification results can be presented as a confusion matrix:

Untitled

An example for cancer:

Untitled

Then we can compute different metrics:

  • Sensitivity or Recall: Recall=TPTP+FNRecall=\frac{TP}{TP+FN}
  • Specificity: Specificity=TNTN+FPSpecificity=\frac{TN}{TN+FP}
  • Precision: Precision=TPTP+FPPrecision=\frac{TP}{TP+FP}
  • Accuracy: Accuracy=TP+TNTP+TN+FP+FNAccuracy=\frac{TP+TN}{TP+TN+FP+FN}

We can visualize them nicely with this schema:

Untitled

Two interesting metrics are Recall and Precision: we often want to maximize both, but they are often opposed (if we increase one, the other is decreased). To solve this paradox, we can use a metric that combine both of them: this is the F1-score.

F1=21Recall+1Precision=2β‹…TP2β‹…TP+FP+FNF_1=\frac{2}{\frac{1}{Recall}+\frac{1}{Precision}}=\frac{2\cdot TP}{2\cdot TP + FP + FN}

We can then make it more general by pondering the Recall and the Precision with a coefficient Ξ²\beta:

Untitled

Untitled

Resources​

F-score