ertk.classification.binary_accuracy_score

ertk.classification.binary_accuracy_score(y_true, y_pred, *, labels=None, average='binary', sample_weight=None)

Calculated binary accuracy. Binary accuracy is the same as accuracy considering only a single class.

Parameters:
y_true:

Ground truth labels.

y_pred:

Predicted labels.

labels: list, optional

Labels to include for average != “binary”. If None, all unique labels in y_true or y_pred are included.

average: str, optional

Method to compute average. If “binary” then simply return accuracy. If “macro” then return mean binary accuracy. If “weighted” then weight the mean binary accuracy by ground truth support. If None then return an array of values, one for each label in labels.

Returns:
label_accs: float or list

Binary accuracies for labels in labels or average if average is not None.