Skip to content

Binary Balanced Accuracy

eva.metrics.BinaryBalancedAccuracy

Bases: BinaryStatScores

Computes the balanced accuracy for binary classification.

compute

Compute accuracy based on inputs passed in to update previously.

Source code in src/eva/core/metrics/binary_balanced_accuracy.py
def compute(self) -> Tensor:
    """Compute accuracy based on inputs passed in to ``update`` previously."""
    tp, fp, tn, fn = self._final_state()
    sensitivity = _safe_divide(tp, tp + fn)
    specificity = _safe_divide(tn, tn + fp)
    return 0.5 * (sensitivity + specificity)