Compute the MulticlassRecallAtFixedPrecision metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute MulticlassRecallAtFixedPrecision, or asks how to score with MulticlassRecallAtFixedPrecision.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill multiclassrecallatfixedprecision --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Multiclassrecallatfixedprecision?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-multiclassrecallatfixedprecision)More formats (shields.io, HTML) on the badges page.
---
name: multiclassrecallatfixedprecision
description: Compute the MulticlassRecallAtFixedPrecision metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute MulticlassRecallAtFixedPrecision, or asks how to score with MulticlassRecallAtFixedPrecision.
metadata:
skill_kind: metric
source_lib: torchmetrics
import_path: torchmetrics.classification.MulticlassRecallAtFixedPrecision
source: library_introspection
---
# multiclassrecallatfixedprecision
> Metric `MulticlassRecallAtFixedPrecision` from `torchmetrics` (torchmetrics.classification.MulticlassRecallAtFixedPrecision)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with MulticlassRecallAtFixedPrecision, or
mentions `torchmetrics.classification.MulticlassRecallAtFixedPrecision` directly, or wants the standard torchmetrics implementation.
## Reference signature
```python
from torchmetrics.classification import MulticlassRecallAtFixedPrecision
# MulticlassRecallAtFixedPrecision(num_classes: int, min_precision: float, 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 highest possible recall value given the minimum precision thresholds provided.
This is done by first calculating the precision-recall curve for different thresholds and the find the recall for
a given precision level.
For multiclass the metric is calculated by iteratively treating each class as the positive class and all other
classes as the negative, which is referred to as the one-vs-rest approach. One-vs-one is currently not supported by
this metric.
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 softmax per sample.
- ``target`` (:class:`~torch.Tensor`): An int tensor of shape ``(N, ...)``. Target should be a tensor containing
ground truth labels, and therefore only contain values in the [0, n_classes-1] range (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 a tuple of either 2 tensors or 2 lists containing:
- ``recall`` (:class:`~torch.Tensor`): A 1d tensor of size ``(n_classes, )`` with the maximum recall for the
given precision level per class
- ``threshold`` (:class:`~torch.Tensor`): A 1d tensor of size ``(n_classes, )`` with the corresponding threshold
level per class
.. note::
The implementation both supports calculating the metric in a non-binned but accurate version and a binned version
that is less accurate but more memory efficient. Setting the `thresholds` argument to ``None`` will activate the
non-binned version that uses memory of size :math:`\mathcal{O}(n_{samples})` whereas setting the `thresholds`
argument to either an integer, list or a 1d tensor will use a binned version that uses memory of
size :math:`\mathcal{O}(n_{thresholds} \times n_{classes})` (constant memory).
Args:
num_classes: Integer specifying the number of classes
min_precision: float value specifying mini
```
## Quick recipe
```python
import torchmetrics.classification as _m
score = _m.MulticlassRecallAtFixedPrecision(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!