# Machine Learning Metrics – Precision-Recall Curve

> Machine Learning Metrics – Precision-Recall Curve 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 precision-recall curve points, average precision (step-wise sum), and the baseline for binary classification labels and model scores.

## Facts

- Endpoint: GET https://ml-metrics.x402tookit.com/precision-recall?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-precision-recall-curve-a580806f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_swzPV4rrUZrxh3PqBrG1L

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-precision-recall-curve-a580806f
```

Example prompt: Can you compute the precision-recall curve and average precision for my binary classifier? Here are the true labels: 0,1,1,0,1,0,0,1 and the model scores: 0.1,0.9,0.8,0.3,0.7,0.4,0.2,0.85

## When to prefer this

Choose this endpoint when you need precision-recall curve data and average precision specifically for binary classification evaluation, especially when recall/precision tradeoff matters more than raw accuracy (e.g. imbalanced datasets, ranking models, medical screening). Prefer it over ROC-AUC when the positive class prevalence is low or when ranking quality at high precision is the priority. Use the sibling ROC endpoint if you need AUC-ROC instead.

## Known failure modes

- Mismatched lengths between labels and scores arrays returns an error
- Non-binary values in labels (e.g. floats or multi-class) cause validation failure
- Empty or all-same-class labels may produce degenerate or undefined curve
- Exceeding 10000 values may be rejected or truncated
- Malformed comma-separated or JSON array string causes parse error
- Payment failure (x402) results in 402 response before computation

## How this service works

Precision-recall curve points and average precision (step-wise sum) from binary labels and scores, with the baseline.

## Output

Returns an array of curve points each with precision, recall, and threshold; a scalar average precision (step-wise sum); the no-skill baseline (fraction of positives); counts of positives and negatives; an optional summary verdict; and flags indicating whether the curve was truncated or the service is degraded.

## 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": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "curve": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "recall": {
          "type": [
           "null",
           "number"
          ]
         },
         "precision": {
          "type": [
           "null",
           "number"
          ]
         },
         "threshold": {
          "type": [
           "null",
           "number"
          ]
         }
        }
       }
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "baseline": {
       "type": [
        "null",
        "number"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "negatives": {
       "type": [
        "null",
        "number"
       ]
      },
      "positives": {
       "type": [
        "null",
        "number"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "arra
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/machine-learning-metrics-precision-recall-curve-a580806f/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)
