# Roc Auc Score

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

- Skill: `qhjqhj00/roc-auc-score` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/roc-auc-score`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/roc-auc-score/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/roc-auc-score

---


# roc-auc-score

> Metric `roc_auc_score` from `scikit-learn` (sklearn.metrics.roc_auc_score)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with roc_auc_score, or
mentions `sklearn.metrics.roc_auc_score` directly, or wants the standard scikit-learn implementation.

## Reference signature

```python
from sklearn.metrics import roc_auc_score

# roc_auc_score(y_true, y_score, *, average='macro', sample_weight=None, max_fpr=None, multi_class='raise', labels=None)
```

## Library docstring

```
Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC)     from prediction scores.

Note: this implementation can be used with :term:`binary`, :term:`multiclass` and
:term:`multilabel` classification, but some restrictions apply (see Parameters).

Read more in the :ref:`User Guide <roc_metrics>`.

Parameters
----------
y_true : array-like of shape (n_samples,) or (n_samples, n_classes)
    True labels or binary label indicators. The binary and multiclass cases
    expect labels with shape (n_samples,) while the multilabel case expects
    binary label indicators with shape (n_samples, n_classes).

y_score : array-like of shape (n_samples,) or (n_samples, n_classes)
    Target scores.

    * In the :term:`binary` case, it corresponds to an array of shape
      `(n_samples,)`. Both probability estimates and non-thresholded
      decision values can be provided. The probability estimates correspond
      to the **probability of the class with the greater label**,
      i.e. `estimator.classes_[1]` and thus
      `estimator.predict_proba(X, y)[:, 1]`. The decision values
      corresponds to the output of `estimator.decision_function(X, y)`.
      See more information in the :ref:`User guide <roc_auc_binary>`;
    * In the :term:`multiclass` case, it corresponds to an array of shape
      `(n_samples, n_classes)` of probability estimates provided by the
      `predict_proba` method. The probability estimates **must**
      sum to 1 across the possible classes. In addition, the order of the
      class scores must correspond to the order of ``labels``,
      if provided, or else to the numerical or lexicographical order of
      the labels in ``y_true``. See more information in the
      :ref:`User guide <roc_auc_multiclass>`;
    * In the :term:`multilabel` case, it corresponds to an array of shape
      `(n_samples, n_classes)`. Probability estimates are provided by the
      `predict_proba` method and the non-thresholded decision values by
      the `decision_function` method. The probability estimates correspond
      to the **probability of the class with the greater label for each
      output** of the classifier. See more information in the
 
```

## Quick recipe

```python
import sklearn.metrics as _m
score = _m.roc_auc_score(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)`.

