Skip to content
Back to skills

Wilcoxon

ASecurity

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

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

Security analysis

A100/100

Scanned September 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Wilcoxon?

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

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

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

# wilcoxon

> Metric `wilcoxon` from `scipy.stats` (scipy.stats.wilcoxon)

## When to invoke this skill

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

## Reference signature

```python
from scipy.stats import wilcoxon

# wilcoxon(x, y=None, zero_method='wilcox', correction=False, alternative='two-sided', method='auto', *, axis=0, nan_policy='propagate', keepdims=False)
```

## Library docstring

```
Calculate the Wilcoxon signed-rank test.

The Wilcoxon signed-rank test tests the null hypothesis that two
related paired samples come from the same distribution. In particular,
it tests whether the distribution of the differences ``x - y`` is symmetric
about zero. It is a non-parametric version of the paired T-test.

Parameters
----------
x : array_like
    Either the first set of measurements (in which case ``y`` is the second
    set of measurements), or the differences between two sets of
    measurements (in which case ``y`` is not to be specified.)  Must be
    one-dimensional.
y : array_like, optional
    Either the second set of measurements (if ``x`` is the first set of
    measurements), or not specified (if ``x`` is the differences between
    two sets of measurements.)  Must be one-dimensional.

    .. warning::
        When `y` is provided, `wilcoxon` calculates the test statistic
        based on the ranks of the absolute values of ``d = x - y``.
        Roundoff error in the subtraction can result in elements of ``d``
        being assigned different ranks even when they would be tied with
        exact arithmetic. Rather than passing `x` and `y` separately,
        consider computing the difference ``x - y``, rounding as needed to
        ensure that only truly unique elements are numerically distinct,
        and passing the result as `x`, leaving `y` at the default (None).
zero_method : {"wilcox", "pratt", "zsplit"}, optional
    There are different conventions for handling pairs of observations
    with equal values ("zero-differences", or "zeros").

    * "wilcox": Discards all zero-differences (default); see [4]_.
    * "pratt": Includes zero-differences in the ranking process,
      but drops the ranks of the zeros (more conservative); see [3]_.
      In this case, the normal approximation is adjusted as in [5]_.
    * "zsplit": Includes zero-differences in the ranking process and
      splits the zero rank between positive and negative ones.
correction : bool, optional
    If True, apply continuity correction by adjusting the Wilcoxon rank
    statistic by 0.5 towards the mean value when computing the
    z-statistic if a normal approximat
```

## Quick recipe

```python
import scipy.stats as _m
score = _m.wilcoxon(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.