aif360.sklearn.metrics
.ratio
- aif360.sklearn.metrics.ratio(func, y_true, y_pred=None, prot_attr=None, priv_group=1, sample_weight=None, zero_division='warn', **kwargs)[source]
Compute the ratio between unprivileged and privileged subsets for an arbitrary metric.
Note: The optimal value of a ratio is 1. To make it a scorer, one must take the minimum of the ratio and its inverse.
Unprivileged group is taken to be the inverse of the privileged group.
- Parameters:
func (function) – A metric function from
sklearn.metrics
oraif360.sklearn.metrics
.y_true (pandas.Series) – Outcome vector with protected attributes as index.
y_pred (array-like, optional) – Estimated outcomes.
prot_attr (array-like, keyword-only) – Protected attribute(s). If
None
, all protected attributes in y are used.priv_group (scalar, optional) – The label of the privileged group.
sample_weight (array-like, optional) – Sample weights passed through to func.
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.
**kwargs – Additional keyword args to be passed through to func.
- Returns:
scalar – Ratio of metric values for unprivileged and privileged groups.