{"uid":"cap_swzPV4rrUZrxh3PqBrG1L","slug":"machine-learning-metrics-precision-recall-curve-a580806f","name":"Machine Learning Metrics – Precision-Recall Curve","description":"Precision-recall curve points and average precision (step-wise sum) from binary labels and scores, with the baseline.","url":"https://ml-metrics.x402tookit.com/precision-recall?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":["array","null"],"items":{"type":"string"}},"curveTruncated":{"type":["boolean","null"]},"averagePrecision":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_UhGTH0sqSsHrNijoi_Rdp","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes precision-recall curve points, average precision (step-wise sum), and the baseline for binary classification labels and model scores.","exampleAgentPrompt":"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","exampleUseCases":[{"title":"Evaluating fraud detection model","prompt":"I have a fraud detection model — here are the true binary labels (1=fraud, 0=legit) and the raw model scores. Can you generate the full precision-recall curve and tell me the average precision so I can see how well it separates fraud from legitimate transactions? Labels: 0,0,1,0,1,1,0,1,0,0 Scores: 0.1,0.2,0.85,0.15,0.9,0.78,0.3,0.95,0.05,0.25"},{"title":"Comparing model iterations on PR curve","prompt":"We just retrained our churn prediction model. Here are the ground truth labels and the new model's predicted scores — can you give me the precision-recall curve points and average precision so I can compare it against the old model's AP of 0.62? Labels: 1,0,1,1,0,0,1,0,1,0 Scores: 0.88,0.12,0.91,0.76,0.34,0.21,0.83,0.44,0.79,0.08"},{"title":"Baseline-aware PR audit for medical classifier","prompt":"I need to audit a cancer screening classifier for a clinical report. Can you run the precision-recall curve and average precision on these binary diagnostic labels and confidence scores, and make sure I see the no-skill baseline too? Labels: 1,1,0,0,1,0,1,0,0,1 Scores: 0.95,0.87,0.2,0.33,0.78,0.41,0.82,0.19,0.27,0.91"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:30:53.550Z","isFirstParty":false,"canonicalSlug":"machine-learning-metrics-precision-recall-curve-a580806f"}