{"uid":"cap_zmuUUZ__w9STHL5leGbYg","slug":"machine-learning-metrics-calibration-ece-mce-brier-score-b6ee779f","name":"Machine Learning Metrics: Calibration (ECE, MCE, Brier Score)","description":"Reliability bins, expected and maximum calibration error and Brier score from binary labels and predicted probabilities.","url":"https://ml-metrics.x402tookit.com/calibration?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","probs"],"properties":{"bins":{"type":"integer","description":"Number of bins, 2 to 50, default 10"},"probs":{"type":"string","description":"Predicted probability of class 1 per sample (0 to 1), same length"},"labels":{"type":"string","description":"True binary labels 0/1, comma-separated or JSON array, up to 10000 values"},"strategy":{"type":"string","description":"uniform (equal-width bins, default) or quantile (equal-count bins)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"bins":{"type":["array","null"],"items":{"type":"object","properties":{"bin":{"type":["null","number"]},"gap":{"type":["null","number"]},"count":{"type":["null","number"]},"lowest":{"type":["null","number"]},"highest":{"type":["null","number"]},"direction":{"type":["null","string"]},"observedRate":{"type":["null","number"]},"meanPredicted":{"type":["null","number"]}}}},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"binCount":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"strategy":{"type":["null","string"]},"brierScore":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"sampleCount":{"type":["null","number"]},"maximumCalibrationError":{"type":["null","number"]},"expectedCalibrationError":{"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_EsP_lqDWJdcQqzpL5VUzA","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 reliability bins, expected calibration error (ECE), maximum calibration error (MCE), and Brier score from binary labels and predicted probabilities.","exampleAgentPrompt":"Check how well my binary classifier is calibrated — here are 500 true labels (0/1): [0,1,0,1,...] and their predicted probabilities: [0.1,0.9,0.2,0.8,...]. Use 10 uniform-width bins and give me the ECE, MCE, Brier score, and reliability bin breakdown.","exampleUseCases":[{"title":"Post-training model calibration audit","prompt":"I just trained a binary classifier and want to know if its predicted probabilities are trustworthy. Here are the true labels and predicted scores for my 1000-sample validation set — can you compute the expected and maximum calibration error using 10 uniform bins, along with the Brier score?"},{"title":"Comparing quantile vs uniform binning","prompt":"Run calibration metrics on these binary labels and predicted probabilities using quantile bins instead of the default uniform strategy — I want to see if the ECE and reliability bins look different when bins have equal counts rather than equal width."},{"title":"Monitoring model calibration drift in production","prompt":"My production model logged predictions and outcomes for the past week — here are 5000 true labels and their predicted probabilities. Calculate the Brier score, ECE, and MCE with 20 bins so I can compare against last week's calibration baseline."}],"resultDescription":"Returns a JSON object with: per-bin statistics (bin index, mean predicted probability, observed positive rate, count, gap, direction), overall expected calibration error (ECE), maximum calibration error (MCE), Brier score, binning strategy used, sample count, a verdict and summary string, and optional warnings/reasons if the computation is degraded.","failureModes":["Missing required 'labels' or 'probs' query parameters returns an error","Labels and probs arrays of different lengths cause a validation failure","Non-binary values in labels (anything other than 0 or 1) will be rejected","Probabilities outside [0, 1] range are invalid and may cause errors","Fewer than 2 samples or empty arrays are not supported","bins parameter outside range 2–50 may be rejected or clamped","Malformed comma-separated strings or invalid JSON arrays cause parse errors"],"whenToPreferThis":"Use this endpoint when you need to assess the probabilistic calibration quality of a binary classification model — specifically when you want ECE, MCE, or Brier score along with per-bin reliability data for plotting calibration curves. Prefer this over simple accuracy metrics when the actual probability values matter (e.g., risk scoring, medical diagnosis, fraud detection). Choose the quantile strategy when class imbalance is present. Other endpoints in this family cover ROC/AUC, precision-recall, confusion matrix, and log loss.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:30:47.557Z","isFirstParty":false,"canonicalSlug":"machine-learning-metrics-calibration-ece-mce-brier-score-b6ee779f"}