aif360.sklearn.metrics
.disparate_impact_ratio
- aif360.sklearn.metrics.disparate_impact_ratio(y_true, y_pred=None, *, prot_attr=None, priv_group=1, pos_label=1, sample_weight=None, zero_division='warn')[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.
zero_division ('warn', 0 or 1) – Sets the value to return when there is a zero division. If set to “warn”, this acts as 0, but warnings are also raised.
- Returns:
float – Disparate impact.
See also