balance_metric#
- balance_metric(labels: ndarray, prot_attr: ndarray)[source]#
Computes the balance fairness metric between protected attributes and class labels.
The balance metric measures how evenly the protected attributes are distributed across different class labels. A value closer to 1 indicates better balance.
- Parameters:
labels (np.ndarray) – Array of class labels for each instance
prot_attr (np.ndarray) – Array of protected attribute values for each instance
- Returns:
Minimum balance ratio across all protected attribute and class label combinations. Values range from 0 to 1, with 1 indicating perfect balance.
- Return type: