# Mannwhitneyu

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

- Skill: `qhjqhj00/mannwhitneyu` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/mannwhitneyu`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/mannwhitneyu/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/mannwhitneyu

---


# mannwhitneyu

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

## When to invoke this skill

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

## Reference signature

```python
from scipy.stats import mannwhitneyu

# mannwhitneyu(x, y, use_continuity=True, alternative='two-sided', axis=0, method='auto', *, nan_policy='propagate', keepdims=False)
```

## Library docstring

```
Perform the Mann-Whitney U rank test on two independent samples.

The Mann-Whitney U test is a nonparametric test of the null hypothesis
that the distribution underlying sample `x` is the same as the
distribution underlying sample `y`. It is often used as a test of
difference in location between distributions.

Parameters
----------
x, y : array-like
    N-d arrays of samples. The arrays must be broadcastable except along
    the dimension given by `axis`.
use_continuity : bool, optional
    Whether a continuity correction (1/2) should be applied.
    Default is True when `method` is ``'asymptotic'``; has no effect
    otherwise.
alternative : {'two-sided', 'less', 'greater'}, optional
    Defines the alternative hypothesis. Default is 'two-sided'.
    Let *SX(u)* and *SY(u)* be the survival functions of the
    distributions underlying `x` and `y`, respectively. Then the following
    alternative hypotheses are available:

    * 'two-sided': the distributions are not equal, i.e. *SX(u) ≠ SY(u)* for
      at least one *u*.
    * 'less': the distribution underlying `x` is stochastically less
      than the distribution underlying `y`, i.e. *SX(u) < SY(u)* for all *u*.
    * 'greater': the distribution underlying `x` is stochastically greater
      than the distribution underlying `y`, i.e. *SX(u) > SY(u)* for all *u*.

    Under a more restrictive set of assumptions, the alternative hypotheses
    can be expressed in terms of the locations of the distributions;
    see [5]_ section 5.1.
axis : int or None, default: 0
    If an int, the axis of the input along which to compute the statistic.
    The statistic of each axis-slice (e.g. row) of the input will appear in a
    corresponding element of the output.
    If ``None``, the input will be raveled before computing the statistic.
method : {'auto', 'asymptotic', 'exact'} or `PermutationMethod` instance, optional
    Selects the method used to calculate the *p*-value.
    Default is 'auto'. The following options are available.

    * ``'asymptotic'``: compares the standardized test statistic
      against the normal distribution, correcting for ties.
    * ``'exact'``: computes the exact *p*-value by comparing the
```

## Quick recipe

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

