{"openapi":"3.1.0","info":{"title":"Classifier Metrics API","version":"1.0.0","description":"Classifier-evaluation maths as an API, computed locally and deterministically. The confusion endpoint turns the four cells of a binary confusion matrix — true and false positives and negatives — into the full metric suite: accuracy, precision, recall (sensitivity), specificity, the F1 score, the Matthews correlation coefficient (robust to class imbalance), balanced accuracy, negative predictive value, the false-positive and false-negative rates and the prevalence. The diagnostic endpoint applies Bayes' theorem to a medical or screening test: from its sensitivity, specificity and the prevalence (pre-test probability) it gives the positive and negative predictive values, the positive and negative likelihood ratios and the diagnostic odds ratio. The fbeta endpoint computes the Fβ score from precision and recall (or from the raw counts) for any β — β = 1 is F1, larger β weights recall, smaller β weights precision. Metrics whose denominator is zero are returned as null rather than erroring. Everything is computed locally and deterministically, so it is instant and private. Ideal for machine-learning, data-science, medical-testing and analytics app developers, model-evaluation and screening tools, and statistics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is classifier evaluation; for descriptive statistics and regression use a statistics API and for hypothesis tests an inference API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/classifier-api","description":"oanor gateway"}],"tags":[{"name":"Classifier"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/confusion":{"get":{"operationId":"get_v1_confusion","tags":["Classifier"],"summary":"Confusion-matrix metrics","description":"","parameters":[{"name":"tp","in":"query","required":true,"description":"True positives","schema":{"type":"string"},"example":"90"},{"name":"fp","in":"query","required":true,"description":"False positives","schema":{"type":"string"},"example":"10"},{"name":"fn","in":"query","required":true,"description":"False negatives","schema":{"type":"string"},"example":"5"},{"name":"tn","in":"query","required":true,"description":"True negatives","schema":{"type":"string"},"example":"95"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"mcc":0.851064,"npv":0.95,"note":"From a binary confusion matrix. MCC (Matthews correlation, −1…1) is robust to class imbalance.","inputs":{"fn":5,"fp":10,"tn":95,"tp":90,"total":200},"recall":0.947368,"accuracy":0.925,"f1_score":0.923077,"precision":0.9,"prevalence":0.475,"sensitivity":0.947368,"specificity":0.904762,"balanced_accuracy":0.926065,"false_negative_rate":0.052632,"false_positive_rate":0.095238},"meta":{"timestamp":"2026-06-05T03:09:02.520Z","request_id":"befbf95c-e77f-40fc-b03f-2073cac0138a"},"status":"ok","message":"Confusion metrics","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/diagnostic":{"get":{"operationId":"get_v1_diagnostic","tags":["Classifier"],"summary":"Diagnostic test","description":"","parameters":[{"name":"sensitivity","in":"query","required":true,"description":"Sensitivity (0–1)","schema":{"type":"string"},"example":"0.95"},{"name":"specificity","in":"query","required":true,"description":"Specificity (0–1)","schema":{"type":"string"},"example":"0.90"},{"name":"prevalence","in":"query","required":true,"description":"Prevalence / pre-test probability (0–1)","schema":{"type":"string"},"example":"0.01"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"npv":0.999439,"ppv":0.087558,"note":"Bayesian PPV/NPV combine the test's sensitivity/specificity with the prevalence (pre-test probability). LR+ = sens/(1−spec).","inputs":{"prevalence":0.01,"sensitivity":0.95,"specificity":0.9},"diagnostic_odds_ratio":171,"likelihood_ratio_negative":0.055556,"likelihood_ratio_positive":9.5},"meta":{"timestamp":"2026-06-05T03:09:02.607Z","request_id":"7bb04f2e-9255-4a0f-a2d0-c40eeb1e85d0"},"status":"ok","message":"Diagnostic test","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/fbeta":{"get":{"operationId":"get_v1_fbeta","tags":["Classifier"],"summary":"F-beta score","description":"","parameters":[{"name":"precision","in":"query","required":false,"description":"Precision (0–1)","schema":{"type":"string"},"example":"0.9"},{"name":"recall","in":"query","required":false,"description":"Recall (0–1)","schema":{"type":"string"},"example":"0.947"},{"name":"tp","in":"query","required":false,"description":"Or true positives","schema":{"type":"string"}},{"name":"fp","in":"query","required":false,"description":"False positives","schema":{"type":"string"}},{"name":"fn","in":"query","required":false,"description":"False negatives","schema":{"type":"string"}},{"name":"beta","in":"query","required":false,"description":"Beta (1 = F1)","schema":{"type":"string"},"example":"1"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"note":"Fβ = (1+β²)·P·R / (β²·P + R). β = 1 is the F1 score; β > 1 weights recall, β < 1 weights precision.","inputs":{"beta":1,"recall":0.947,"precision":0.9},"fbeta_score":0.922902},"meta":{"timestamp":"2026-06-05T03:09:02.691Z","request_id":"02505d3c-9447-4a49-9f73-bd9dee3bad2a"},"status":"ok","message":"F-beta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"notes":"Counts are non-negative integers; rates and probabilities are 0–1. Metrics with a zero denominator are returned as null.","service":"classifier-api","formulae":{"f1":"2·P·R/(P+R)","mcc":"(TP·TN − FP·FN)/√((TP+FP)(TP+FN)(TN+FP)(TN+FN))","ppv":"(sens·prev)/(sens·prev + (1−spec)(1−prev))","recall":"TP/(TP+FN)","precision":"TP/(TP+FP)"},"endpoints":{"GET /v1/meta":"This document.","GET /v1/fbeta":"F-beta score from precision & recall (or tp/fp/fn) for any beta.","GET /v1/confusion":"Accuracy, precision, recall, F1, MCC and more from tp/fp/fn/tn.","GET /v1/diagnostic":"PPV, NPV and likelihood ratios from sensitivity, specificity and prevalence."},"description":"Classifier-evaluation metrics: a full metric suite from a confusion matrix, Bayesian diagnostic-test statistics (PPV/NPV, likelihood ratios), and the F-beta score."},"meta":{"timestamp":"2026-06-05T03:09:02.760Z","request_id":"d0e26edb-baa4-4c53-8da7-649522f850b6"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":3000,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":600,"monthly_call_quota":40000,"rps_limit":5,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1800,"monthly_call_quota":250000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":5900,"monthly_call_quota":1500000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/classifier-api"}