fatf.utils.metrics.subgroup_metrics.apply_metric

fatf.utils.metrics.subgroup_metrics.apply_metric(population_confusion_matrix, metric=None, label_index=0, **kwargs)[source]

Applies one of the predefined performance metric to all confusion matrices.

Available metrics are:

  • true positive rate,

  • true negative rate,

  • false positive rate,

  • false negative rate,

  • positive predictive value,

  • negative predictive value,

  • accuracy, and

  • treatment.

Parameters
population_confusion_matrixList[numpy.ndarray]

A list of confusion matrices for each sub-population.

metricstring, optional (default=’accuracy’)

A performance metric identifier that will be used.

label_indexinteger, optional (default=0)

The index of a label that should be treated as “positive”. All the other labels will be treated as “negative”. This is only useful when the confusion matrices are multi-class.

Returns
metricsList[number]

A list with the value of the selected metric for every sub-population.

Raises
TypeError

The metric parameter is not a string.

ValueError

The metric parameter specifies an unknown metric.