aif360.sklearn.metrics.statistical_parity_difference

aif360.sklearn.metrics.statistical_parity_difference(*y, prot_attr=None, priv_group=1, pos_label=1, sample_weight=None)[source]

Difference in selection rates.

\[Pr(\hat{Y} = \text{pos_label} | D = \text{unprivileged}) - Pr(\hat{Y} = \text{pos_label} | D = \text{privileged})\]

Note

If only y_true is provided, this will return the difference in base rates (statistical parity difference of the original dataset). If both y_true and y_pred are provided, only y_pred is used.

Parameters:
  • y_true (pandas.Series) – Ground truth (correct) target values. If y_pred is provided, this is ignored.
  • y_pred (array-like, optional) – Estimated targets as returned by a classifier.
  • prot_attr (array-like, keyword-only) – Protected attribute(s). If None, all protected attributes in y_true are used.
  • priv_group (scalar, optional) – The label of the privileged group.
  • pos_label (scalar, optional) – The label of the positive class.
  • sample_weight (array-like, optional) – Sample weights.
Returns:

float – Statistical parity difference.