# Multilabelprecisionrecallcurve

> Compute the MultilabelPrecisionRecallCurve metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute MultilabelPrecisionRecallCurve, or asks how to score with MultilabelPrecisionRecallCurve.

- Skill: `qhjqhj00/multilabelprecisionrecallcurve` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/multilabelprecisionrecallcurve`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/multilabelprecisionrecallcurve/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/multilabelprecisionrecallcurve

---


# multilabelprecisionrecallcurve

> Metric `MultilabelPrecisionRecallCurve` from `torchmetrics` (torchmetrics.classification.MultilabelPrecisionRecallCurve)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with MultilabelPrecisionRecallCurve, or
mentions `torchmetrics.classification.MultilabelPrecisionRecallCurve` directly, or wants the standard torchmetrics implementation.

## Reference signature

```python
from torchmetrics.classification import MultilabelPrecisionRecallCurve

# MultilabelPrecisionRecallCurve(num_labels: int, thresholds: Union[int, list[float], torch.Tensor, NoneType] = None, ignore_index: Optional[int] = None, validate_args: bool = True, **kwargs: Any) -> None
```

## Library docstring

```
Compute the precision-recall curve for multilabel tasks.

The curve consist of multiple pairs of precision and recall values evaluated at different thresholds, such that the
tradeoff between the two values can been seen.

As input to ``forward`` and ``update`` the metric accepts the following input:

- ``preds`` (:class:`~torch.Tensor`): A float tensor of shape ``(N, C, ...)``. Preds should be a tensor containing
  probabilities or logits for each observation. If preds has values outside [0,1] range we consider the input to
  be logits and will auto apply sigmoid per element.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, C, ...)``. Target should be a tensor containing
  ground truth labels, and therefore only contain {0,1} values (except if `ignore_index` is specified).

.. tip::
   Additional dimension ``...`` will be flattened into the batch dimension.

As output to ``forward`` and ``compute`` the metric returns the following a tuple of either 3 tensors or
3 lists containing:

- ``precision`` (:class:`~torch.Tensor` or :class:`~List`): if `thresholds=None` a list for each label is returned
  with an 1d tensor of size ``(n_thresholds+1, )`` with precision values (length may differ between labels). If
  `thresholds` is set to something else, then a single 2d tensor of size ``(n_labels, n_thresholds+1)`` with
  precision values is returned.
- ``recall`` (:class:`~torch.Tensor` or :class:`~List`): if `thresholds=None` a list for each label is returned
  with an 1d tensor of size ``(n_thresholds+1, )`` with recall values (length may differ between labels). If
  `thresholds` is set to something else, then a single 2d tensor of size ``(n_labels, n_thresholds+1)`` with recall
  values is returned.
- ``thresholds`` (:class:`~torch.Tensor` or :class:`~List`): if `thresholds=None` a list for each label is
  returned with an 1d tensor of size ``(n_thresholds, )`` with increasing threshold values (length may differ
  between labels). If `threshold` is set to something else, then a single 1d tensor of size ``(n_thresholds, )``
  is returned with shared threshold values for all labels.

.. note::
   The implementation both supports calculating the metri
```

## Quick recipe

```python
import torchmetrics.classification as _m
score = _m.MultilabelPrecisionRecallCurve(y_true, y_pred)
```

## Don'ts

- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.

