fairlearn.metrics.true_positive_rate#

fairlearn.metrics.true_positive_rate(y_true, y_pred, sample_weight=None, pos_label=None)[source]#

Calculate the true positive rate (also called sensitivity, recall, or hit rate).

Read more in the User Guide.

Parameters:
  • y_true (array-like) – The list of true values

  • y_pred (array-like) – The list of predicted values

  • sample_weight (array-like, optional) – A list of weights to apply to each sample. By default all samples are weighted equally

  • pos_label (scalar, optional) – The value to treat as the ‘positive’ label in the samples. If None (the default) then the largest unique value of the y arrays will be used.

Returns:

The true positive rate for the data

Return type:

float