# Machine Learning Metrics: ROC Curve and AUC

> Machine Learning Metrics: ROC Curve and AUC is a paid API for AI agents from ml-metrics.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-02).

Computes ROC curve points and AUC from binary labels and model scores using the Mann-Whitney rank-sum identity, with tie-handling.

## Facts

- Endpoint: GET https://ml-metrics.x402tookit.com/roc-auc?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/machine-learning-metrics-roc-curve-and-auc-4de827ff
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_n4lJ4tPaaLbX0ubcSSbVS

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability machine-learning-metrics-roc-curve-and-auc-4de827ff
```

Example prompt: Can you compute the ROC curve and AUC for my binary classifier? The true labels are 0,1,1,0,1,0,0,1 and the model scores are 0.1,0.9,0.8,0.2,0.75,0.3,0.4,0.85.

## When to prefer this

Choose this endpoint when you need AUC and the full ROC curve for a binary classifier, especially when tie-handling via the Mann-Whitney rank-sum identity matters for correctness. Prefer it over precision-recall endpoints when the task is ranking/discrimination evaluation rather than threshold-specific performance. Use it when you need both the curve coordinates (for plotting) and the scalar AUC in one call.

## Known failure modes

- Labels and scores arrays have different lengths — returns an error
- Non-binary labels (values other than 0/1) cause a validation failure
- Empty or malformed input arrays fail to parse
- All labels are the same class (all 0 or all 1) — AUC is undefined, may return null
- Very large inputs (over 10000 values) are rejected
- URL encoding issues with comma-separated values in query params

## How this service works

ROC curve points and AUC from binary labels and scores via the Mann-Whitney rank-sum identity, with ties counted half.

## Output

Returns an array of ROC curve points each with false positive rate (FPR), true positive rate (TPR), and threshold; the AUC value via Mann-Whitney rank-sum; a trapezoid AUC; Gini coefficient; counts of positives and negatives; a summary string; a verdict; and optionally a degraded flag and disclaimer if the result is approximate or the curve was truncated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "labels",
      "scores"
     ],
     "properties": {
      "labels": {
       "type": "string",
       "description": "True binary labels 0/1, comma-separated or JSON array, up to 10000 values"
      },
      "scores": {
       "type": "string",
       "description": "Model scores (higher = more positive), same length as labels"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "auc": {
       "type": [
        "null",
        "number"
       ]
      },
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "gini": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "negatives": {
       "type": [
        "null",
        "number"
       ]
      },
      "positives": {
       "type": [
        "null",
        "number"
       ]
      },
      "rocPoints": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "fpr": {
          "type": [
           "null",
           "number"
          ]
         },
         "tpr": {
          "type": [
           "null",
           "number"
          ]
         },
         "threshold": {
          "type": [
           "null",
           "number"
          ]
         }
        }
       }
      },
      "disclaimer": {
       "type": [
        "null",
        "stri
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/machine-learning-metrics-roc-curve-and-auc-4de827ff/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from ml-metrics.x402tookit.com](https://www.zero.xyz/host/ml-metrics.x402tookit.com/llms.txt)
