fatf.fairness.models.measures
.disparate_impact_indexed¶
-
fatf.fairness.models.measures.
disparate_impact_indexed
(indices_per_bin: List[numpy.ndarray], ground_truth: numpy.ndarray, predictions: numpy.ndarray, label_index: int = 0, labels: Optional[List[Union[float, str]]] = None, tolerance: float = 0.2, criterion: Optional[str] = None) → numpy.ndarray[source]¶ Calculates selected disparate impact grid for indexed data.
This function combines
fatf.utils.metrics.tools.confusion_matrix_per_subgroup_indexed
function together withfatf.utils.metrics.subgroup_metrics.apply_metric
function. For the description of parameters, errors and exceptions please see the documentation of these functions.- Parameters
- indices_per_bin, ground_truth, predictions, and labels
See the documentation of
fatf.utils.metrics.tools.confusion_matrix_per_subgroup_indexed
function.- label_indexinteger
The index of the “positive” class in the confusion matrix. (Not required for binary problems.) See the description of
fatf.utils.data.tools.group_by_column
function.- criterionUnion[None, string]
A string representing group fairness criterion. One of:
'demographic parity'
,'equal opportunity'
,'equal accuracy'
orNone
for the default option'equal accuracy'
.- tolerancenumber
A number between 0 and 1 that indicates how much any two metrics can differ to be considered “equal”.
- Returns
- disparity_gridnumpy.ndarray
A square, symmetric, boolean numpy array that indicates for which pair of sub-populations a disparity happens.
- Raises
- TypeError
The
criterion
parameter is neitherNone
nor a string.- ValueError
The
criterion
parameter is none of the allowed values (see the description of the parameter).