fairness.functions

class fairgrad.fairness_functions.AccuracyParity(y_unique, s_unique, y, s)

The function implements the accuracy parity fairness function. A model \(h_θ\) is fair for Accuracy Parity when theprobability of being correct is independent of the sensitive attribute.

Parameters
  • y_unique (npt.ndarray[int]) – all unique labels in all label space.

  • s_unique (npt.ndarray[int]) – all unique protected attributes in all protected attribute space.

  • y (npt.ndarray[int]) – all label space

  • s (npt.ndarray[int]) – all protected attribute space

class fairgrad.fairness_functions.DemographicParity(y_unique, s_unique, y, s)

The function implements the demographic parity fairness function. A model \(h_θ\) is fair for Demographic Parity when the probability of predicting each label is independent of the sensitive attribute.

Parameters
  • y_unique (npt.ndarray[int]) – all unique labels in all binary label space.

  • s_unique (npt.ndarray[int]) – all unique protected attributes in all protected attribute space.

  • y (npt.ndarray[int]) – all binary label space

  • s (npt.ndarray[int]) – all protected attribute space

class fairgrad.fairness_functions.EqualityOpportunity(y_unique, s_unique, y, s, y_desirable)

The function implements the accuracy parity fairness function. A model \(h_θ\) is fair for Equality of Opportunity when the probability of predicting the correct label is independent of the sensitive attribute for a given subset of labels called the desirable outcomes

Parameters
  • y_unique (npt.ndarray[int]) – all unique labels in all label space.

  • s_unique (npt.ndarray[int]) – all unique protected attributes in all protected attribute space.

  • y (npt.ndarray[int]) – all label space

  • s (npt.ndarray[int]) – all protected attribute space

  • y_desirable (npt.ndarray[int]) – the label for which the fairness needs to be enforced.

class fairgrad.fairness_functions.EqualizedOdds(y_unique, s_unique, y, s)

The function implements the equal odds fairness function. A model \(h_θ\) is fair for Equalized Odds when the probability of predicting the correct label is independent of the sensitive attribute.

Parameters
  • y_unique (npt.ndarray[int]) – all unique labels in all label space.

  • s_unique (npt.ndarray[int]) – all unique protected attributes in all protected attribute space.

  • y (npt.ndarray[int]) – all label space

  • s (npt.ndarray[int]) – all protected attribute space