Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA028 · Metric
AUROC, precision–recall, and operating-point OOD evaluation
Evaluates anomaly or out-of-distribution ranking and threshold behavior.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- Evaluate out-of-distribution detection Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Complete calculation
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through evaluate.ood. The reference's example ran here in one language.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Evaluates anomaly or out-of-distribution ranking and threshold behavior.
Question / hypotheses
Can a score rank relevant positive cases above negative cases, and what happens at the chosen alert threshold?
Architecture / computational structure
A fixed scoring/calibration pipeline applied to model outputs or supplied observations; the formula and usage sections identify its operations.
Assumptions
Specify which class is positive, the evaluation prevalence, and the unit of independence. The chosen OOD datasets should represent plausible shifts.
Formula / computational definition
Parameters and notation
Score direction, positive class, PR integration method, and target TPR are hyperparameters. FPR@95TPR depends on threshold selection/interpolation. Average precision is not identical to trapezoidal PR area.
Fitting, fine-tuning, and adaptation
There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.
How to use and calibrate
Report AUROC, average precision, prevalence, and operational false-alert rates. Choose thresholds on validation data, then hold them fixed on the test set.
Example application
Compare reconstruction-error and isolation-based anomaly scores for equipment monitoring.
Interpretation / pitfalls
Watch out
High AUROC can coexist with poor precision for rare anomalies. Different OOD mixtures can reverse rankings. Repeated windows from one failure must not be treated as independent events.
Python and R code examples
Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs sklearn
from sklearn.metrics import roc_auc_score,average_precision_score
y=[0,0,0,1,1]; score=[.1,.2,.6,.5,.9]
print(roc_auc_score(y,score),average_precision_score(y,score))
Bridge to another language — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline. · needs reticulate
# Same metric definitions through a bridge; binary labels, larger score means positive.
m <- reticulate::import("sklearn.metrics"); y <- c(0L,0L,0L,1L,1L); s <- c(.1,.2,.6,.5,.9)
print(m$roc_auc_score(y,s)); print(m$average_precision_score(y,s))
Sources
- Source 1arxiv.org
- Source 2scikit-learn.org
From the CodeSplash reference, entry EVA028.