torcheval.metrics.functional.multilabel_recall_at_fixed_precision¶
- torcheval.metrics.functional.multilabel_recall_at_fixed_precision(input: Tensor, target: Tensor, *, num_labels: int, min_precision: float) Tuple[List[Tensor], List[Tensor]]¶
返回在多标签分类任务中,每个标签在给定最小精度下的最高可能召回值及其对应的阈值。每个标签的最大召回计算等同于binary_recall_at_fixed_precision中的_binary_recall_at_fixed_precision_compute。
它的类版本是
torcheval.metrics.MultilabelRecallAtFixedPrecision。- Parameters:
input (Tensor) – 标签预测的张量 它应该是形状为 (n_samples, n_label) 的概率
target (Tensor) – 形状为 (n_samples, n_label) 的真实标签张量
num_labels (int) – 标签数量
min_precision (float) – 最小精度阈值
- Returns:
- List[torch.Tensor], thresholds: List[torch.Tensor])
recall: 每个标签的最大召回值列表 thresholds: 每个标签的最佳阈值列表
- Return type:
一个元组,包含(召回率
示例
>>> import torch >>> from torcheval.metrics.functional import multilabel_recall_at_fixed_precision >>> input = torch.tensor([[0.75, 0.05, 0.35], [0.45, 0.75, 0.05], [0.05, 0.55, 0.75], [0.05, 0.65, 0.05]]) >>> target = torch.tensor([[1, 0, 1], [0, 0, 0], [0, 1, 1], [1, 1, 1]]) >>> multilabel_recall_at_fixed_precision(input, target, num_labels=3, min_precision=0.5) ([tensor([1.0, 1.0, 1.0], tensor([0.05, 0.55, 0.05])])