# fatf.utils.metrics.tools.confusion_matrix_per_subgroup_indexed¶

fatf.utils.metrics.tools.confusion_matrix_per_subgroup_indexed(indices_per_bin, ground_truth, predictions, labels=None)[source]

Computes confusion matrices for every defined sub-population.

This is useful for computing a variety of performance metrics based on predefined instance index binning for each sub-population.

This is an alternative to fatf.utils.metrics.tools.confusion_matrix_per_subgroup function, which can be used when one already has the desired instance binning.

For warnings and errors raised by this method please see the documentation of fatf.utils.data.tools.validate_indices_per_bin function.

Parameters
indices_per_binList[List[integer]]

A list of lists with the latter one holding row indices of a particular group (sub-population).

ground_truth, predictions, and labels

These parameters are described in the documentation of fatf.utils.metrics.tools.get_confusion_matrix function and are used to calculate confusion matrices.

Returns
population_confusion_matrixList[numpy.ndarray]

A list of confusion matrices for each sub-population.