rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.86k stars 857 forks source link

Balanced accuracy does not work for binary case #762

Closed rasbt closed 3 years ago

rasbt commented 3 years ago

There seems to be an issue with the balanced accuracy when the class labels are binary labels. I.e.,

from mlxtend.evaluate import accuracy_score

a = [0, 0, 0, 0, 1, 1]
b = [0, 0, 1, 1, 1, 1]

accuracy_score(a, b)
0.6666666666666666

and

accuracy_score(a, b, method='average')
0.6666666666666666

even though the second result should be 0.75

rasbt commented 3 years ago

NVM. Everything was correct before; I got confused because there are two types of balanced accuracy measures in literature. For this type, everything works as intended.