max_fairness_cost#

max_fairness_cost(labels: ndarray, prot_attr: ndarray, ideal_dist: dict)[source]#

Calculates the maximum fairness cost based on deviation from an ideal distribution.

This metric measures how far the actual distribution of protected attributes within each class is from an ideal (fair) distribution.

Parameters:
  • labels (np.ndarray) – Array of class labels for each instance

  • prot_attr (np.ndarray) – Array of protected attribute values for each instance

  • ideal_dist (dict) – Dictionary mapping protected attribute values to their ideal proportions

Returns:

Maximum fairness cost across all class labels. Lower values indicate distributions closer to the ideal fair distribution.

Return type:

float