Skip to content
Back to skills

Catmetric

ASecurity

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

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

Security analysis

A100/100

Scanned September 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Catmetric?

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

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

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: catmetric
description: Compute the CatMetric metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute CatMetric, or asks how to score with CatMetric.
metadata:
  skill_kind: metric
  source_lib: torchmetrics
  import_path: torchmetrics.CatMetric
  source: library_introspection
---

# catmetric

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

## When to invoke this skill

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

## Reference signature

```python
from torchmetrics import CatMetric

# CatMetric(nan_strategy: Union[Literal['error', 'warn', 'ignore', 'disable'], float] = 'warn', **kwargs: Any) -> None
```

## Library docstring

```
Concatenate a stream of values.

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

- ``value`` (:class:`~float` or :class:`~torch.Tensor`): a single float or an tensor of float values with
  arbitrary shape ``(...,)``.

As output of `forward` and `compute` the metric returns the following output

- ``agg`` (:class:`~torch.Tensor`): scalar float tensor with concatenated values over all input received

Args:
    nan_strategy: options:
        - ``'error'``: if any `nan` values are encountered will give a RuntimeError
        - ``'warn'``: if any `nan` values are encountered will give a warning and continue
        - ``'ignore'``: all `nan` values are silently removed
        - ``'disable'``: disable all `nan` checks
        - a float: if a float is provided will impute any `nan` values with this value

    kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.

Raises:
    ValueError:
        If ``nan_strategy`` is not one of ``error``, ``warn``, ``ignore``, ``disable`` or a float

Example:
    >>> from torch import tensor
    >>> from torchmetrics.aggregation import CatMetric
    >>> metric = CatMetric()
    >>> metric.update(1)
    >>> metric.update(tensor([2, 3]))
    >>> metric.compute()
    tensor([1., 2., 3.])
```

## Quick recipe

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