torcheval.metrics.functional.binary_recall_at_fixed_precision¶
-
torcheval.metrics.functional.
binary_recall_at_fixed_precision
(input: Tensor, target: Tensor, *, min_precision: float) Tuple[Tensor, Tensor] [source]¶ Returns the highest possible recall value given the minimum precision for binary classification tasks.
Its class version is
torcheval.metrics.BinaryRecallAtFixedPrecision
. See alsomultilabel_recall_at_fixed_precision
Parameters: - input (Tensor) – Tensor of label predictions It should be probabilities with shape of (n_samples, )
- target (Tensor) – Tensor of ground truth labels with shape of (n_samples, )
- min_precision (float) – Minimum precision threshold
Returns: - recall (Tensor): Max recall value given the minimum precision
- thresholds (Tensor): Corresponding threshold to max recall
Return type: Tuple
Examples:
>>> import torch >>> from torcheval.metrics.functional import binary_recall_at_fixed_precision >>> input = torch.tensor([0.1, 0.4, 0.6, 0.6, 0.6, 0.35, 0.8]) >>> target = torch.tensor([0, 0, 1, 1, 1, 1, 1]) >>> binary_recall_at_fixed_precision(input, target, min_precision=0.5) (torch.tensor(1.0), torch.tensor(0.35))