Calculate precision, recall, F1, F2, F0.5, specificity, and balanced accuracy from a confusion matrix.