This question might be trivial, but I have problems understanding this line taken from here:
The balanced_accuracy_score function computes the balanced accuracy, which avoids inflated performance estimates on imbalanced datasets. It is the macro-average of recall scores per class or, equivalently, raw accuracy where each sample is weighted according to the inverse prevalence of its true class. Thus for balanced datasets, the score is equal to accuracy.
I have particular problems with the last line. So let's take the definition as sklearn provides it: $$\text{bal}\_{\text{acc}} := \frac{1}{2}\left(\frac{\text{TP}}{\text{TP}+\text{FN}} + \frac{\text{TN}}{\text{TN+FP}}\right)$$ The way I understood it, for a balanced dataset, $\text{TP} = \text{TN}$. Therefore, the last Eq. can be rewritten to: $$\text{bal}\_{\text{acc}} := \frac{1}{2}\left(\frac{\text{TP}}{\text{TP}+\text{FN}} + \frac{\text{TP}}{\text{TP+FP}}\right) = \frac{1}{2}\left(\frac{\text{TP}\left(\text{TP}+\text{FP}\right)}{\left(\text{TP}+\text{FN}\right)\left(\text{TP}+\text{FP}\right)} + \frac{\text{TP}\left( \text{TP}+\text{FN}\right)}{\left(\text{TP+FP}\right)\left(\text{TP}+\text{FN}\right)}\right) = \frac{1}{2}\frac{\text{TP}\left( \text{TP}+\text{FN}\right) + \text{TP}\left(\text{TP}+\text{FP}\right)}{\left(\text{TP+FP}\right)\left(\text{TP}+\text{FN}\right)}$$
Unfortunately, I do not see how we can recover the "classical" accuracy: $$\text{acc} := \frac{\text{TP}+\text{TN}}{\text{TP}+\text{TN}+\text{FP}+\text{FN}}$$ Assuming that $\text{TP}=\text{TN}$ again, we have: $$\text{acc} = \frac{2\text{TP}}{2\text{TP}+\text{FP}+\text{FN}}$$ Could anybody help, please?