Saltar al contenido principal

BalancedAccuracy

Metric
DashAI.back.metrics.classification.BalancedAccuracy

Average of recall obtained on each class.

Balanced Accuracy is the macro-average of recall scores per class. It avoids the inflated performance estimates that plain accuracy gives on imbalanced datasets, since each class contributes equally regardless of how many samples it has.

::

Balanced Accuracy = (1 / C) * sum(recall_c for c in classes)

Range: [0, 1], higher is better (MAXIMIZE = True).

References

Methods

score(true_labels: 'DashAIDataset', probs_pred_labels: 'np.ndarray') -> float

Defined on BalancedAccuracy

Calculate the balanced accuracy between true and predicted labels.

Parameters

true_labels : DashAIDataset
A DashAI dataset with labels.
probs_pred_labels : np.ndarray
A two-dimensional matrix in which each column represents a class and the row values represent the probability that an example belongs to the class associated with the column.

Returns

float
Balanced accuracy score between true labels and predicted labels

get_metadata(cls: 'BaseMetric') -> Dict[str, Any]

Defined on BaseMetric

Get metadata values for the current metric.

Returns

Dict[str, Any]
Dictionary with the metadata

is_multiclass(true_labels: 'np.ndarray') -> bool

Defined on ClassificationMetric

Determine if the classification problem is multiclass (more than 2 classes).

Parameters

true_labels : np.ndarray
Array of true labels.

Returns

bool
True if the problem has more than 2 unique classes, False otherwise.

Compatible with