{"uid":"cap_t8QWGhI2oeFLhLS6S0a9G","slug":"machine-learning-metrics-log-loss-cross-entropy-1eb301c7","name":"Machine Learning Metrics: Log Loss (Cross Entropy)","description":"Binary or multiclass log loss (cross entropy) with epsilon clipping, plus the no-skill baseline and worst samples.","url":"https://ml-metrics.x402tookit.com/log-loss?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":{"eps":{"type":"string","description":"Clipping epsilon, default 1e-15, between 1e-300 and 0.5"},"probs":{"type":"string","description":"Binary: P(label=1) per sample, comma list. Multiclass: JSON array of per-sample probability rows"},"labels":{"type":"string","description":"Binary: 0/1 labels. Multiclass: class index (0-based) or class name per sample; up to 10000 values"},"classes":{"type":"string","description":"Multiclass only: class names in the column order of probs, if labels are names"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"mode":{"type":["null","string"]},"source":{"type":["null","string"]},"epsilon":{"type":["null","number"]},"logLoss":{"type":["null","number"]},"reasons":{"type":["array","null"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"classCount":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"sampleCount":{"type":["null","number"]},"worstSamples":{"type":["array","null"],"items":{"type":"object","properties":{"loss":{"type":["null","number"]},"index":{"type":["null","number"]}}}},"clippedValues":{"type":["null","number"]},"uniformBaseline":{"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_M0G2wWq6xB3h52StpnEYn","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 binary or multiclass log loss (cross entropy) with epsilon clipping, plus the no-skill uniform baseline and the worst-performing samples.","exampleAgentPrompt":"Compute the log loss for my binary classifier — labels are 0,1,0,1,1 and the predicted probabilities of class 1 are 0.1,0.9,0.2,0.8,0.7 — and also tell me the no-skill baseline and which samples performed worst.","exampleUseCases":[{"title":"Binary classifier evaluation after training","prompt":"I just trained a binary spam classifier. The true labels are 0,0,1,1,0,1 and my model's predicted probabilities of spam are 0.05,0.12,0.85,0.78,0.3,0.92. Can you compute the log loss and show me the no-skill baseline so I know how much better I'm doing than random?"},{"title":"Multiclass model quality check","prompt":"I have a 3-class image classifier. The true class indices are 0,1,2,0,2 and the per-sample probability rows are [[0.8,0.1,0.1],[0.2,0.7,0.1],[0.1,0.2,0.7],[0.6,0.3,0.1],[0.05,0.05,0.9]]. Compute the multiclass log loss and flag the worst-performing samples for me."},{"title":"Debugging overconfident wrong predictions","prompt":"My model seems overconfident on the wrong samples. Labels are 1,0,1,0,1 and predicted probabilities are 0.01,0.99,0.05,0.95,0.1. Calculate the log loss with default epsilon clipping and list the samples with the highest individual loss so I can see which predictions are hurting me most."}],"resultDescription":"Returns a JSON object with the computed log loss value, the uniform (no-skill) baseline loss, the number of samples and classes, the operating mode (binary or multiclass), the epsilon used for clipping, the count of clipped values, an array of worst-performing samples with their index and individual loss, plus a summary verdict and optional disclaimer.","failureModes":["Missing required 'labels' or 'probs' query parameters returns an error","Mismatched length between labels and probs arrays causes a validation error","Probability values outside [0,1] after clipping may produce unexpected results","Invalid epsilon value outside allowed range (1e-300 to 0.5) causes rejection","Malformed JSON for multiclass probs array returns a parse error","Class name labels with no matching 'classes' parameter may cause ambiguity errors","Payment failure ($0.02 USDC) blocks the request entirely"],"whenToPreferThis":"Use this endpoint when you need a fast, pay-per-call log loss computation without setting up any ML framework. It is particularly useful when you want the no-skill baseline and worst sample identification in the same call, for both binary and multiclass settings, and when you need epsilon clipping to safely handle extreme probability predictions.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:30:23.923Z","isFirstParty":false,"canonicalSlug":"machine-learning-metrics-log-loss-cross-entropy-1eb301c7"}