Skip to content
Back to skills

Spatialcorrelationcoefficient

ASecurity

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

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

Security analysis

A100/100

Scanned September 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Spatialcorrelationcoefficient?

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

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

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

# spatialcorrelationcoefficient

> Metric `SpatialCorrelationCoefficient` from `torchmetrics` (torchmetrics.image.SpatialCorrelationCoefficient)

## When to invoke this skill

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

## Reference signature

```python
from torchmetrics.image import SpatialCorrelationCoefficient

# SpatialCorrelationCoefficient(high_pass_filter: Optional[torch.Tensor] = None, window_size: int = 8, **kwargs: Any) -> None
```

## Library docstring

```
Compute Spatial Correlation Coefficient (SCC_).

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

- ``preds`` (:class:`~torch.Tensor`): Predictions from model of shape ``(N,C,H,W)`` or ``(N,H,W)``.
- ``target`` (:class:`~torch.Tensor`): Ground truth values of shape ``(N,C,H,W)`` or ``(N,H,W)``.

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

- ``scc`` (:class:`~torch.Tensor`): Tensor with scc score

Args:
    hp_filter: High-pass filter tensor. default: tensor([[-1,-1,-1],[-1,8,-1],[-1,-1,-1]]).
    window_size: Local window size integer. default: 8.
    kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.

Example:
    >>> from torch import randn
    >>> from torchmetrics.image import SpatialCorrelationCoefficient as SCC
    >>> preds = randn([32, 3, 64, 64])
    >>> target = randn([32, 3, 64, 64])
    >>> scc = SCC()
    >>> scc(preds, target)
    tensor(0.0023)
```

## Quick recipe

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