Skip to content

ML evaluation statistics and provenance

Research date: 2026-09-20. Planning evidence, not an approved implementation design.

Repository baseline

CONTEXT.md assigns measurement meaning and acceptance policy to Consumers and keeps Evaluation Case contents in process. src/telemetry/performance/evaluation.py currently reduces each trial to one finite measurement score, bootstraps repeated trial summaries, and exposes pass/fail/unavailable rule statuses. statistics.py implements deterministic percentile bootstrap (2,000 resamples by default), nearest-rank percentiles, and bounded finite-number validation. Retain these safety and dependency boundaries while adding explicitly versioned statistical capabilities.

Recommendations and testable contracts

Paired comparisons and sampling units

SciPy supports paired resampling using common indices and distinguishes percentile, basic, and BCa intervals; degenerate data can make BCa intervals undefined. Its API also exposes confidence level, random generator, resample count, and batch size. SciPy bootstrap

Recommendation: introduce an in-process comparison executor that runs both candidates against matching case identities and resamples their score difference with common indices. Report the estimand, sampling unit, method/version, confidence, independent-unit count, and resample seed. Keep the existing repeatability interval separately labelled: repeated deterministic runs cannot establish population uncertainty. Use 95% confidence and 10,000 bounded percentile resamples as an explicit initial policy, not a claim that this is universally adequate; add BCa only with jackknife cost and degeneracy handling covered. Do not silently switch interval methods.

Support consumer-declared independent clusters (for example one user containing multiple rows), resampling entire clusters together, with explicit equal-cluster versus row-weighted estimands. Do not treat repeated rows as independent. For task suites, stratification is a separate choice: RLiable resamples runs within tasks and reports uncertainty rather than relying only on point estimates. RLiable research

Contracts: shuffled matching IDs produce equivalent paired evidence; duplicate/missing pairs reject comparison; singleton independent-unit sets cannot claim population confidence; unequal cluster sizes obey the selected weighting; fixed seeds reproduce results; corpus measurements recompute on each resample rather than averaging per-case values; raw values and cluster labels never enter reports.

Practical significance and insufficient evidence

Recommendation: Consumers provide an absolute minimum worthwhile improvement in measurement units. Orient differences so positive always means improvement. For interval [L,U] and threshold d, use pass when L > d, fail when U < d, otherwise inconclusive; specify equality explicitly as inconclusive. Keep non-inferiority (allowed regression) a separate rule. Preserve unavailable for missing or invalid evidence; it is distinct from a valid but inconclusive interval. Relative rules require an explicit zero-baseline policy. Prespecify required slices and measurement families; do not interpret a search over many candidates as one confirmatory comparison. These are recommended decision contracts, not thresholds dictated by the cited packages.

Contracts: interval crossing the threshold never passes; maximize/minimize yield consistent decisions; boundary equality is tested; missing/incompatible/partial evidence has stable reason codes; multiple required gates cannot pass when any required result is inconclusive or unavailable.

Sample sufficiency and tail latency

There is no universal sample count that establishes useful tail precision. Recommendation: retain descriptive quantiles for small samples but withhold inferential gate evidence until a declared precision criterion is met. Compute a distribution-free quantile interval from binomial order-statistic ranks under independent sampling; expose unbounded endpoints when the data cannot bracket the tail. For threshold exceedance use an exact binomial proportion interval, with the sampling assumptions recorded. SciPy supplies exact and Wilson proportion intervals. SciPy binomial intervals

For intuition, under independent sampling the probability of observing no values beyond population p99 is 0.99^n: about 299 observations merely give a 95% chance of seeing at least one such value. That is not evidence of a precise p99 estimate. This calculation is a derivation, not a recommended minimum. Correlated serving arrivals require a declared block/run-level method instead.

Contracts: p99 from ten observations is descriptive only; all-success/all-failure proportions have valid nonzero uncertainty; exact-rank fixtures match a trusted reference; minimum unit count and interval-width criteria are explicit; no adaptive stopping claim without an appropriate sequential method; bounded sampling retains documented approximation/error guarantees.

Optional measurement packs and calibration

Scikit-learn documents averaging, labels, weighting, and zero-division semantics for F1. These choices change the meaning of scores and belong in measurement identity. F1 API

Recommendation: optional adapters for classification (accuracy, balanced accuracy, precision/recall/F1, ROC AUC, average precision), regression (MAE, RMSE, R2), and probabilistic quality (log loss, Brier). Make label ordering, positive class, averaging, weights, and undefined-value policy explicit. Return unavailable for mathematically undefined metrics rather than manufacturing a favorable finite score. Core imports must not load scikit-learn.

Brier/log loss measure calibration and discrimination together; a lower loss does not establish better calibration alone. Reliability diagrams require bin-level counts. Calibration fitting needs data independent of estimator training, and test-set leakage must be avoided. Calibration guide

Contracts: adapter results match pinned reference fixtures for binary/multiclass/weighted/degenerate cases; probability arrays validate shape, labels, finite values, range, and normalization; calibration summaries carry bin strategy/counts; bounded reliability summaries omit predictions; any ECE option records binning and is not presented as a proper scoring rule.

Provenance, dataset identity, and history

MLflow separates dataset name, digest, schema, profile, and source. Its API documentation explicitly describes sampled hashing for an evaluation dataset, so tracker-provided digests must not be assumed to prove complete content identity. MLflow data API

Recommendation: require consumer-supplied immutable dataset revision plus split and preprocessing identity for comparison; optionally accept a consumer-computed complete-content digest with declared algorithm and scope. Never hash arbitrary sensitive payloads automatically. Record model artifact, measurement implementation/configuration, code/dependencies, execution environment, and separately named seeds in a bounded allowlisted manifest. Compatibility is measurement-specific: hardware is essential for latency, but not automatically disqualifying for semantic quality comparisons.

MLflow sources need not reproduce transformed datasets exactly. MLflow REST dataset fields Therefore local immutable report history should store report/manifest identities and explicit parent baseline references; optional export maps those identities to tracker runs without replacing the local evidence contract. Export metadata-only by default. MLflow also supports curated evaluation datasets from traces, which requires consumer-owned redaction and consent outside this library's payload-free report path. MLflow evaluation datasets

Contracts: changed data revision with unchanged case names rejects strict comparison; changed metric configuration rejects that metric; identical manifests canonicalize identically; latency environment mismatches return structured explanations; secrets/paths/URLs do not leak through automatic capture; history writes are atomic and detect corruption; offline operation requires no tracker; interrupted exports are retryable without duplicate local records.

Verification scope

Read-only inspection: pwd, git status --short, cat CONTEXT.md, rg --files for performance and research paths, sed on statistics/evaluation, and rg for relevant symbols. Browsed the linked primary documentation. No Python tools, production changes, or tests were run; this document supplies backlog acceptance criteria, not implementation or runtime evidence.