aif360.sklearn.metrics.disparate_impact_ratio

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

Ratio of selection rates.

\[\frac{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 ratio of base rates (disparate impact 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 – Disparate impact.