Compute the BinaryPrecisionRecallCurve metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute BinaryPrecisionRecallCurve, or asks how to score with BinaryPrecisionRecallCurve.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill binaryprecisionrecallcurve --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Binaryprecisionrecallcurve?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-binaryprecisionrecallcurve)More formats (shields.io, HTML) on the badges page.
---
name: binaryprecisionrecallcurve
description: Compute the BinaryPrecisionRecallCurve metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute BinaryPrecisionRecallCurve, or asks how to score with BinaryPrecisionRecallCurve.
metadata:
skill_kind: metric
source_lib: torchmetrics
import_path: torchmetrics.classification.BinaryPrecisionRecallCurve
source: library_introspection
---
# binaryprecisionrecallcurve
> Metric `BinaryPrecisionRecallCurve` from `torchmetrics` (torchmetrics.classification.BinaryPrecisionRecallCurve)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with BinaryPrecisionRecallCurve, or
mentions `torchmetrics.classification.BinaryPrecisionRecallCurve` directly, or wants the standard torchmetrics implementation.
## Reference signature
```python
from torchmetrics.classification import BinaryPrecisionRecallCurve
# BinaryPrecisionRecallCurve(thresholds: Union[int, list[float], torch.Tensor, NoneType] = None, ignore_index: Optional[int] = None, validate_args: bool = True, normalization: Optional[Literal['sigmoid', 'softmax']] = 'sigmoid', **kwargs: Any) -> None
```
## Library docstring
```
Compute the precision-recall curve for binary 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, ...)``. 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, ...)``. Target should be a tensor containing
ground truth labels, and therefore only contain {0,1} values (except if `ignore_index` is specified). The value
1 always encodes the positive class.
.. tip::
Additional dimension ``...`` will be flattened into the batch dimension.
As output to ``forward`` and ``compute`` the metric returns the following output:
- ``precision`` (:class:`~torch.Tensor`): if `thresholds=None` a list for each class is returned with an 1d
tensor of size ``(n_thresholds+1, )`` with precision values (length may differ between classes). If `thresholds`
is set to something else, then a single 2d tensor of size ``(n_classes, n_thresholds+1)`` with precision values
is returned.
- ``recall`` (:class:`~torch.Tensor`): if `thresholds=None` a list for each class is returned with an 1d tensor
of size ``(n_thresholds+1, )`` with recall values (length may differ between classes). If `thresholds` is set to
something else, then a single 2d tensor of size ``(n_classes, n_thresholds+1)`` with recall values is returned.
- ``thresholds`` (:class:`~torch.Tensor`): if `thresholds=None` a list for each class is returned with an 1d
tensor of size ``(n_thresholds, )`` with increasing threshold values (length may differ between classes). If
`threshold` is set to something else, then a single 1d tensor of size ``(n_thresholds, )`` is returned with
shared threshold values for all classes.
.. note::
The implementation both supports calculating the metric in a non-binned but accurate version and a binned ve
```
## Quick recipe
```python
import torchmetrics.classification as _m
score = _m.BinaryPrecisionRecallCurve(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)`.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!