## Balanced Accuracy

Balanced accuracy is defined as the average of positive class accuracy and the negative class accuracy. Assume your data set has 20 positive samples and 80 negative samples. Your model predicted 23 samples as positive and 77 samples as negative as shown in the confusion matrix below.

|                            | Predicted positive  | Predicted negative | Total |
|-----------------|--------------------|---------------------|------|
| Actual positive  |         TP = 15            |          FN = 5            | 20     |
| Actual negative |         FP = 8              |          TN =72          | 80     |
| Total                   |             23                |               77              | 100   |

Based on this confusion matrix: 
your _**positive class accuracy**_ = 15 / (15+5) = 0.75 
your _**negative class accuracy**_ = 72 / (72+8) = 0.90
Therefore, your _**balanced accuracy**_ = (0.75 + 0.90) / 2 = 0.825
