aif360.sklearn.metrics.ratio

aif360.sklearn.metrics.ratio(func, y, *args, prot_attr=None, priv_group=1, sample_weight=None, **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 or aif360.sklearn.metrics.metrics.
  • y (pandas.Series) – Outcome vector with protected attributes as index.
  • *args – Additional positional args to be passed through to func.
  • 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.
  • **kwargs – Additional keyword args to be passed through to func.
Returns:

scalar – Ratio of metric values for unprivileged and privileged groups.