Skip to content
Back to skills

Minmaxmetric

ASecurity

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

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 11, 2026
documentationpython

Security analysis

A100/100

Scanned September 11, 2026

npx -y skills add qhjqhj00/research-skills-pool --skill minmaxmetric --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Minmaxmetric?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Minmaxmetric
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qhjqhj00-minmaxmetric/badge)](https://www.skillsdirectory.com/skills/qhjqhj00-minmaxmetric)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: minmaxmetric
description: Compute the MinMaxMetric metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute MinMaxMetric, or asks how to score with MinMaxMetric.
metadata:
  skill_kind: metric
  source_lib: torchmetrics
  import_path: torchmetrics.MinMaxMetric
  source: library_introspection
---

# minmaxmetric

> Metric `MinMaxMetric` from `torchmetrics` (torchmetrics.MinMaxMetric)

## When to invoke this skill

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

## Reference signature

```python
from torchmetrics import MinMaxMetric

# MinMaxMetric(base_metric: torchmetrics.metric.Metric, **kwargs: Any) -> None
```

## Library docstring

```
Wrapper metric that tracks both the minimum and maximum of a scalar/tensor across an experiment.

The min/max value will be updated each time ``.compute`` is called.

Args:
    base_metric:
        The metric of which you want to keep track of its maximum and minimum values.
    kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.

Raises:
    ValueError
        If ``base_metric` argument is not a subclasses instance of ``torchmetrics.Metric``

Example::
    >>> import torch
    >>> from torchmetrics.wrappers import MinMaxMetric
    >>> from torchmetrics.classification import BinaryAccuracy
    >>> from pprint import pprint
    >>> base_metric = BinaryAccuracy()
    >>> minmax_metric = MinMaxMetric(base_metric)
    >>> preds_1 = torch.Tensor([[0.1, 0.9], [0.2, 0.8]])
    >>> preds_2 = torch.Tensor([[0.9, 0.1], [0.2, 0.8]])
    >>> labels = torch.Tensor([[0, 1], [0, 1]]).long()
    >>> pprint(minmax_metric(preds_1, labels))
    {'max': tensor(1.), 'min': tensor(1.), 'raw': tensor(1.)}
    >>> pprint(minmax_metric.compute())
    {'max': tensor(1.), 'min': tensor(1.), 'raw': tensor(1.)}
    >>> minmax_metric.update(preds_2, labels)
    >>> pprint(minmax_metric.compute())
    {'max': tensor(1.), 'min': tensor(0.7500), 'raw': tensor(0.7500)}
```

## Quick recipe

```python
import torchmetrics as _m
score = _m.MinMaxMetric(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)`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.