25

I was wondering if anyone could explain the difference between balanced accuracy which is

b_acc = (sensitivity + specificity)/2

and f1 score which is:

f1 = 2*precision*recall/(precision + recall) 
dvreed77
  • 747

1 Answers1

30

Mathematically, b_acc is the arithmetic mean of recall_P and recall_N and f1 is the harmonic mean of recall_P and precision_P.

Both F1 and b_acc are metrics for classifier evaluation, that (to some extent) handle class imbalance. Depending of which of the two classes (N or P) outnumbers the other, each metric is outperforms the other.

1) If N >> P, f1 is a better.

2) If P >> N, b_acc is better.

Clearly, if you can label-switch, both the metrics can be used in any of the two imbalance cases above. If not, then depending on the imbalance in the training data, you can select the appropriate metric.

Shashwat
  • 324
  • 1
    Thank you sir, Do you have a reference for the info regarding choosing Fscore vs balanced accuracy in terms of number of positive/negative classes? – gin Apr 15 '19 at 14:16
  • I would like to second @gin's request for more info on how to choose between the two. I have some data that where the N is about 8%. By answer above, it seems like I should use Balanced Accuracy. I've been looking for other references on this choice (P > N -> b_acc) but haven't seen anything. – anguyen1210 Sep 25 '19 at 07:29
  • 5
    This doesn't make any sense to me. Balanced accuracy is invariant under label switching. How can you "make it better" by label switching if it will be unchanged? – T.C. Proctor Dec 18 '19 at 23:43
  • 1
    @T.C.Proctor Can balanced accuracy change in rank relative to F1 given the label switch? – Alex Aug 31 '20 at 15:58