evalsuite-python 0.6.1__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/CHANGELOG.md +64 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/PKG-INFO +49 -43
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/README.md +48 -42
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/Cargo.lock +2 -2
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/Cargo.toml +1 -1
- evalsuite_python-0.7.1/rust/evalsuite-core/src/agreement.rs +38 -0
- evalsuite_python-0.7.1/rust/evalsuite-core/src/curve.rs +250 -0
- evalsuite_python-0.7.1/rust/evalsuite-core/src/groups.rs +115 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/lib.rs +7 -0
- evalsuite_python-0.7.1/rust/evalsuite-core/src/permutation.rs +92 -0
- evalsuite_python-0.7.1/rust/evalsuite-core/src/qa.rs +97 -0
- evalsuite_python-0.7.1/rust/evalsuite-core/src/ranks.rs +99 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/resample.rs +3 -3
- evalsuite_python-0.7.1/rust/evalsuite-core/src/surface.rs +287 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-py/src/lib.rs +347 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/classification/metrics.py +87 -5
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/_common.py +34 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/agents.py +6 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/longcontext.py +30 -11
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/multilingual.py +17 -8
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/robustness.py +23 -12
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/safety.py +60 -11
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/_resolve.py +73 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/intervals.py +20 -3
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/factuality.py +10 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/judge.py +18 -9
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/qa.py +25 -2
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/reasoning.py +35 -7
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/version.py +1 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/vision/segmentation.py +17 -1
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/test_native.py +280 -2
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/CONTRIBUTING.md +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/LICENSE +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/LICENSE-APACHE +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/pyproject.toml +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/Cargo.toml +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/README.md +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/coco.rs +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/hash.rs +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/meteor.rs +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/ter.rs +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-core/src/text.rs +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/rust/evalsuite-py/Cargo.toml +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/__main__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/_bench_metrics.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/_lazy.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/_native.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/api.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/benchmarks.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/calibration.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/classification/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/classification/_common.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/cli/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/cli/main.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/clinical/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/clinical/metrics.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/clinical/report.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/context.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/exceptions.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/export.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/registry.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/result.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/types.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/core/validation.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/code.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/efficiency.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/llmsys/uncertainty.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/plot.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/py.typed +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/regression/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/regression/metrics.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/reporting.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/compare.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/effect.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/hypothesis.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/paired.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/stats/results.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/_common.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/generation.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/rag.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/report.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/retrieval.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/semantic.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/spice.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/text/structured.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/vision/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/src/evalsuite/vision/detection.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/classification/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/classification/test_against_sklearn.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/clinical/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/clinical/test_outputs.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/clinical/test_v020.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/conftest.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/integration/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/integration/test_qa.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/integration/test_readme_examples.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/integration/test_repo_hygiene.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_code_longcontext_efficiency.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_edges.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_fast_text.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_hardening.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_safety_robustness.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/llmsys/test_uncertainty_agents_multilingual.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/output/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/output/test_benchmarks.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/output/test_cli.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/output/test_plot.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/output/test_reporting.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/regression/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/regression/test_against_sklearn.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/stats/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/stats/test_branches.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/stats/test_compare.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/stats/test_fast_paths.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/stats/test_reference.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/text/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/text/test_against_references.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/text/test_text_edges.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/text/test_v040.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/unit/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/unit/test_core.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/unit/test_edges.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/vision/__init__.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/vision/test_detection.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/vision/test_edges.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/vision/test_outputs.py +0 -0
- {evalsuite_python-0.6.1 → evalsuite_python-0.7.1}/tests/vision/test_segmentation.py +0 -0
|
@@ -6,6 +6,70 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.7.1] - 2026-11-25
|
|
10
|
+
|
|
11
|
+
More statistics, vision and QA work in the compiled core. Every default result is unchanged (bit-identical to
|
|
12
|
+
the Python fallback, checked by `tests/test_native.py`); the new `resampling="native"` option of
|
|
13
|
+
`weat_effect_size` is opt-in.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Bootstrap of ROC AUC and average precision** (`bootstrap_ci`, `paired_bootstrap_test`, `compare`): every
|
|
17
|
+
resample's curve in one parallel compiled call. With unit weights a resample is one linear pass over the data's
|
|
18
|
+
presorted order with multiplicities (counts are exact integers, so no re-sort); with weights each resample is
|
|
19
|
+
gathered and stably sorted. The BCa jackknife reuses one presort for every left-out block. A 2,000-resample BCa
|
|
20
|
+
interval on 100,000 observations: 28.9 s → 5.9 s (4.0 s with `resampling="native"`, 2 cores).
|
|
21
|
+
- **DeLong test and DeLong AUC intervals**: one sort per model yields all three mid-rankings (exact
|
|
22
|
+
half-integers) instead of three SciPy `rankdata` calls: 3×.
|
|
23
|
+
- **QA metrics**: SQuAD answer normalisation, exact match and token F1 in the core for ASCII text (Unicode text
|
|
24
|
+
keeps Python's case mapping): `token_f1` 6.3×, `exact_match` 2.4×, and `majority_vote_accuracy` normalises in
|
|
25
|
+
one batch.
|
|
26
|
+
- **Hausdorff distance / HD95 / average symmetric surface distance**: surfaces extracted in parallel and exact
|
|
27
|
+
nearest-surface distances from a dense-bitmap shell search with an exact k-d tree fallback, using the same
|
|
28
|
+
arithmetic as the direct comparison: 1.2–6× faster on 2-D and 3-D masks, identical results.
|
|
29
|
+
- **Calibration** (`calibration_curve`, `expected_calibration_error`, and the metrics built on them): bin search
|
|
30
|
+
and the three weighted bin sums in one pass: 4.4× at 1,000,000 samples.
|
|
31
|
+
- **WEAT permutation test**: exact enumeration of the splits in the core (53×, identical p-values), and
|
|
32
|
+
opt-in `resampling="native"` for the random splits (26×; seeded and thread-count independent, a different
|
|
33
|
+
random stream from NumPy's).
|
|
34
|
+
- Tool-call metrics reuse one JSON encoder for their call keys (byte-identical keys, 1.3×).
|
|
35
|
+
- Parity tests for every new kernel, and the thread-count invariance test now covers the new parallel paths.
|
|
36
|
+
|
|
37
|
+
### Not ported
|
|
38
|
+
- No concordance / C-index metric exists in EvalSuite, so there was nothing to port (adding one is a feature,
|
|
39
|
+
not a port).
|
|
40
|
+
- Turning words into ids for the text metrics: a compiled interner gave no gain, because the Python 3.9 stable
|
|
41
|
+
ABI the wheels target has to copy every string, which costs as much as Python's dict lookup.
|
|
42
|
+
- EvalSuite has no fairness module; the multilingual per-language split is a dictionary lookup.
|
|
43
|
+
- Multiple-testing corrections (`adjust_pvalues`): a compiled sort was slower than NumPy 2's SIMD sort at
|
|
44
|
+
10,000–100,000 p-values and only marginally faster at 1,000,000, so the NumPy code stays.
|
|
45
|
+
|
|
46
|
+
## [0.7.0] - 2026-11-24
|
|
47
|
+
|
|
48
|
+
More of EvalSuite runs in the compiled Rust core. Every result is unchanged: each new kernel is bit-identical to
|
|
49
|
+
the Python implementation it replaces (checked by `tests/test_native.py`), which stays as the fallback.
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
- **ROC AUC and average precision** in the core: one stable sort per column, columns in parallel, with NumPy's
|
|
53
|
+
pairwise summation reproduced exactly. `evaluate()` now shares that sort between ROC AUC and average precision
|
|
54
|
+
(cached on its context), so it sorts each probability column once instead of twice. `evaluate()` with
|
|
55
|
+
probabilities: 2.5× faster (binary) to 4.3× (5-class, 1M samples); `roc_auc` 2.6×, `average_precision` 2×.
|
|
56
|
+
- **LLM-systems consistency metrics** (`paraphrase_consistency`, `response_stability`,
|
|
57
|
+
`cross_document_consistency`, `cross_lingual_consistency`, `majority_vote_accuracy`): answer groups are
|
|
58
|
+
counted in the core (equal pairs from answer counts, O(m) instead of O(m²) pair comparisons): 1.4–4.8×.
|
|
59
|
+
- **Rows of numbers read directly by the core** (no per-row NumPy arrays): `groundedness` 5×,
|
|
60
|
+
`citation_coverage` 7.8×, `toxicity_score` 6×, `exposure` 3×.
|
|
61
|
+
- **Pairwise preferences**: sequential `elo_ratings` 3.6×, and the Bradley–Terry win matrix.
|
|
62
|
+
- Parity tests for every new kernel (ties, sample weights, micro/macro/weighted/per-class, one-vs-one,
|
|
63
|
+
non-string answers, invalid inputs raising the same errors).
|
|
64
|
+
|
|
65
|
+
### Not ported, on purpose
|
|
66
|
+
- Retrieval metrics: already 11–15× faster than ranx in Python; mapping document ids to the core cost more than
|
|
67
|
+
it saved.
|
|
68
|
+
- Krippendorff's alpha: already one vectorised NumPy pass; a compiled version was only 1.5× faster and could not
|
|
69
|
+
reproduce NumPy's matrix-multiply rounding, so results would have changed in the last digit.
|
|
70
|
+
- Fleiss' kappa and judge agreement are single vectorised integer passes; metrics built on Python's `ast`, JSON
|
|
71
|
+
or regular expressions (syntax validity, tool-call keys, answer normalisation) stay in Python.
|
|
72
|
+
|
|
9
73
|
## [0.6.1] - 2026-11-24
|
|
10
74
|
|
|
11
75
|
Finishes the Rust port. Results are unchanged (bit-identical to the Python reference) unless you opt in to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: Intended Audience :: Healthcare Industry
|
|
@@ -85,11 +85,13 @@ Project-URL: Source, https://github.com/mkcs28/evalsuite-python
|
|
|
85
85
|
EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
|
|
86
86
|
evaluation into one consistent, validated, documented framework.
|
|
87
87
|
|
|
88
|
-
> **Status: stable (0.
|
|
88
|
+
> **Status: stable (0.7.1).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
89
89
|
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
90
90
|
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
91
|
-
> 0.
|
|
92
|
-
>
|
|
91
|
+
> **0.7.0** moves ROC AUC / average precision (and so `evaluate()`), the LLM-systems consistency metrics,
|
|
92
|
+
> groundedness, citation coverage, toxicity, exposure and Elo into the core.
|
|
93
|
+
> **0.7.1** adds bootstrapped ROC AUC / AP (4–5× faster intervals), DeLong, QA exact match / F1,
|
|
94
|
+
> Hausdorff / surface distances, calibration and the WEAT permutation test.
|
|
93
95
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
94
96
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
95
97
|
|
|
@@ -113,10 +115,10 @@ is needed. Anywhere else pip falls back to a pure-Python wheel that gives exactl
|
|
|
113
115
|
|
|
114
116
|
The core runs independent examples (sentences, images, classes, resamples) in parallel on all CPU cores; set
|
|
115
117
|
`EVALSUITE_NUM_THREADS` to cap the number of threads. Results never depend on the thread count: sums are always
|
|
116
|
-
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`)
|
|
117
|
-
`resampling="native"` to draw
|
|
118
|
-
`random_state` and faster on large inputs, but a different random stream from
|
|
119
|
-
interval endpoints differ slightly (statistically equivalent).
|
|
118
|
+
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`) and
|
|
119
|
+
`weat_effect_size` accept `resampling="native"` to draw resamples (or permutations) in the core (seeded
|
|
120
|
+
xoshiro256++): reproducible with `random_state` and faster on large inputs, but a different random stream from
|
|
121
|
+
the default NumPy one, so interval endpoints and p-values differ slightly (statistically equivalent).
|
|
120
122
|
|
|
121
123
|
## Why EvalSuite
|
|
122
124
|
|
|
@@ -358,53 +360,57 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
|
|
|
358
360
|
|
|
359
361
|
## Performance
|
|
360
362
|
|
|
361
|
-
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.
|
|
363
|
+
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.7.1, Python 3.13,
|
|
362
364
|
NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
|
|
363
|
-
difference 2.5e-14),
|
|
364
|
-
0.89
|
|
365
|
-
27 cases and three sizes is **4.
|
|
365
|
+
difference 2.5e-14), 80 are faster (the other, the maintainability index, runs Python's own `ast` parser
|
|
366
|
+
like radon and lands at 0.89× on this run), and the geometric-mean speed-up across all
|
|
367
|
+
27 cases and three sizes is **4.30×**. At 1,000,000 samples (pixels for
|
|
366
368
|
segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
|
|
367
369
|
alphabetical order:
|
|
368
370
|
|
|
369
371
|
| Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
|
|
370
372
|
| --- | --- | ---: | ---: | ---: |
|
|
371
|
-
| 10 classes: macro F1 | scikit-learn |
|
|
372
|
-
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.
|
|
373
|
-
| binary: 8 label metrics via evaluate() | scikit-learn |
|
|
374
|
-
| binary: ROC AUC | scikit-learn |
|
|
375
|
-
| calibration: slope and intercept | statsmodels |
|
|
376
|
-
| clinical: diagnostic report (7 CIs) | statsmodels |
|
|
377
|
-
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn |
|
|
378
|
-
| decision curve: 99 thresholds | NumPy loop |
|
|
379
|
-
| detection: COCO evaluation (1000 images) | pycocotools |
|
|
380
|
-
| multiple testing: Hochberg (n p-values) | statsmodels |
|
|
381
|
-
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn |
|
|
382
|
-
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx |
|
|
383
|
-
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn |
|
|
384
|
-
| segmentation: Hausdorff distance (50 images) | SciPy |
|
|
385
|
-
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.
|
|
386
|
-
| statistics: Mann–Whitney U | SciPy |
|
|
387
|
-
| statistics: Welch t-test | SciPy |
|
|
388
|
-
| structured: JSON Schema compliance (10000 documents) | jsonschema |
|
|
389
|
-
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu |
|
|
390
|
-
| systems: confidence AUROC (n answers) | scikit-learn |
|
|
391
|
-
| systems: distribution-shift drop, Welch CI (n scores) | SciPy |
|
|
392
|
-
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema |
|
|
393
|
-
| systems: latency p50 / p95 / p99 (n requests) | NumPy |
|
|
394
|
-
| systems: maintainability index (1000 programs) | radon |
|
|
395
|
-
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU |
|
|
396
|
-
| text: METEOR, exact and stem matches (10000 sentences) | NLTK |
|
|
397
|
-
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score |
|
|
373
|
+
| 10 classes: macro F1 | scikit-learn | 9.2 | 106.2 | **11.5×** |
|
|
374
|
+
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.7 | 3.6 | **2.1×** |
|
|
375
|
+
| binary: 8 label metrics via evaluate() | scikit-learn | 10.0 | 932.8 | **93.4×** |
|
|
376
|
+
| binary: ROC AUC | scikit-learn | 86.2 | 305.1 | **3.5×** |
|
|
377
|
+
| calibration: slope and intercept | statsmodels | 209.6 | 1146.2 | **5.5×** |
|
|
378
|
+
| clinical: diagnostic report (7 CIs) | statsmodels | 5.2 | 5.9 | **1.1×** |
|
|
379
|
+
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 20.9 | 381.9 | **18.3×** |
|
|
380
|
+
| decision curve: 99 thresholds | NumPy loop | 145.7 | 190.2 | **1.3×** |
|
|
381
|
+
| detection: COCO evaluation (1000 images) | pycocotools | 37.2 | 731.1 | **19.7×** |
|
|
382
|
+
| multiple testing: Hochberg (n p-values) | statsmodels | 74.3 | 79.7 | **1.1×** |
|
|
383
|
+
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 7.9 | 13.4 | **1.7×** |
|
|
384
|
+
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 156.1 | 583.6 | **3.7×** |
|
|
385
|
+
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 36.1 | 248.7 | **6.9×** |
|
|
386
|
+
| segmentation: Hausdorff distance (50 images) | SciPy | 4.6 | 16.6 | **3.6×** |
|
|
387
|
+
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.4×** |
|
|
388
|
+
| statistics: Mann–Whitney U | SciPy | 135.5 | 303.6 | **2.2×** |
|
|
389
|
+
| statistics: Welch t-test | SciPy | 7.1 | 10.4 | **1.5×** |
|
|
390
|
+
| structured: JSON Schema compliance (10000 documents) | jsonschema | 103.6 | 211.7 | **2.0×** |
|
|
391
|
+
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 334.9 | 592.4 | **1.8×** |
|
|
392
|
+
| systems: confidence AUROC (n answers) | scikit-learn | 162.4 | 265.7 | **1.6×** |
|
|
393
|
+
| systems: distribution-shift drop, Welch CI (n scores) | SciPy | 8.4 | 9.6 | **1.1×** |
|
|
394
|
+
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 108.1 | 252.4 | **2.3×** |
|
|
395
|
+
| systems: latency p50 / p95 / p99 (n requests) | NumPy | 13.2 | 15.0 | **1.1×** |
|
|
396
|
+
| systems: maintainability index (1000 programs) | radon | 100.8 | 89.5 | 0.89× |
|
|
397
|
+
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 206.2 | 2405.2 | **11.7×** |
|
|
398
|
+
| text: METEOR, exact and stem matches (10000 sentences) | NLTK | 72.2 | 404.0 | **5.6×** |
|
|
399
|
+
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 179.5 | 678.9 | **3.8×** |
|
|
398
400
|
|
|
399
401
|
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
|
|
400
402
|
statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
|
|
401
403
|
independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
|
|
402
|
-
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.
|
|
404
|
+
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.64×** (171 of 172
|
|
403
405
|
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
404
406
|
|
|
405
|
-
**
|
|
406
|
-
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation)
|
|
407
|
-
|
|
407
|
+
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
408
|
+
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
409
|
+
ROC AUC and average precision (one sort per column, shared by both inside `evaluate()`), the LLM-systems
|
|
410
|
+
consistency, groundedness, citation, toxicity and exposure metrics, Elo ratings, bootstrap resampling (including
|
|
411
|
+
whole bootstrap and jackknife runs of ROC AUC / AP), DeLong, QA exact match and F1,
|
|
412
|
+
Hausdorff and surface distances, calibration bins and the WEAT permutation test run in the compiled,
|
|
413
|
+
multithreaded Rust core; bootstrap intervals, paired bootstrap tests and
|
|
408
414
|
`compare()` evaluate confusion-matrix metrics from counts of each resample's (true, predicted) pairs instead of
|
|
409
415
|
copies of the data. `evaluate()` validates inputs once and builds the confusion
|
|
410
416
|
matrix once for all metrics, and integer labels are encoded without sorting. The rank tests rank the data once
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
|
|
11
11
|
evaluation into one consistent, validated, documented framework.
|
|
12
12
|
|
|
13
|
-
> **Status: stable (0.
|
|
13
|
+
> **Status: stable (0.7.1).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
14
14
|
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
15
15
|
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
16
|
-
> 0.
|
|
17
|
-
>
|
|
16
|
+
> **0.7.0** moves ROC AUC / average precision (and so `evaluate()`), the LLM-systems consistency metrics,
|
|
17
|
+
> groundedness, citation coverage, toxicity, exposure and Elo into the core.
|
|
18
|
+
> **0.7.1** adds bootstrapped ROC AUC / AP (4–5× faster intervals), DeLong, QA exact match / F1,
|
|
19
|
+
> Hausdorff / surface distances, calibration and the WEAT permutation test.
|
|
18
20
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
19
21
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
20
22
|
|
|
@@ -38,10 +40,10 @@ is needed. Anywhere else pip falls back to a pure-Python wheel that gives exactl
|
|
|
38
40
|
|
|
39
41
|
The core runs independent examples (sentences, images, classes, resamples) in parallel on all CPU cores; set
|
|
40
42
|
`EVALSUITE_NUM_THREADS` to cap the number of threads. Results never depend on the thread count: sums are always
|
|
41
|
-
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`)
|
|
42
|
-
`resampling="native"` to draw
|
|
43
|
-
`random_state` and faster on large inputs, but a different random stream from
|
|
44
|
-
interval endpoints differ slightly (statistically equivalent).
|
|
43
|
+
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`) and
|
|
44
|
+
`weat_effect_size` accept `resampling="native"` to draw resamples (or permutations) in the core (seeded
|
|
45
|
+
xoshiro256++): reproducible with `random_state` and faster on large inputs, but a different random stream from
|
|
46
|
+
the default NumPy one, so interval endpoints and p-values differ slightly (statistically equivalent).
|
|
45
47
|
|
|
46
48
|
## Why EvalSuite
|
|
47
49
|
|
|
@@ -283,53 +285,57 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
|
|
|
283
285
|
|
|
284
286
|
## Performance
|
|
285
287
|
|
|
286
|
-
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.
|
|
288
|
+
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.7.1, Python 3.13,
|
|
287
289
|
NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
|
|
288
|
-
difference 2.5e-14),
|
|
289
|
-
0.89
|
|
290
|
-
27 cases and three sizes is **4.
|
|
290
|
+
difference 2.5e-14), 80 are faster (the other, the maintainability index, runs Python's own `ast` parser
|
|
291
|
+
like radon and lands at 0.89× on this run), and the geometric-mean speed-up across all
|
|
292
|
+
27 cases and three sizes is **4.30×**. At 1,000,000 samples (pixels for
|
|
291
293
|
segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
|
|
292
294
|
alphabetical order:
|
|
293
295
|
|
|
294
296
|
| Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
|
|
295
297
|
| --- | --- | ---: | ---: | ---: |
|
|
296
|
-
| 10 classes: macro F1 | scikit-learn |
|
|
297
|
-
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.
|
|
298
|
-
| binary: 8 label metrics via evaluate() | scikit-learn |
|
|
299
|
-
| binary: ROC AUC | scikit-learn |
|
|
300
|
-
| calibration: slope and intercept | statsmodels |
|
|
301
|
-
| clinical: diagnostic report (7 CIs) | statsmodels |
|
|
302
|
-
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn |
|
|
303
|
-
| decision curve: 99 thresholds | NumPy loop |
|
|
304
|
-
| detection: COCO evaluation (1000 images) | pycocotools |
|
|
305
|
-
| multiple testing: Hochberg (n p-values) | statsmodels |
|
|
306
|
-
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn |
|
|
307
|
-
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx |
|
|
308
|
-
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn |
|
|
309
|
-
| segmentation: Hausdorff distance (50 images) | SciPy |
|
|
310
|
-
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.
|
|
311
|
-
| statistics: Mann–Whitney U | SciPy |
|
|
312
|
-
| statistics: Welch t-test | SciPy |
|
|
313
|
-
| structured: JSON Schema compliance (10000 documents) | jsonschema |
|
|
314
|
-
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu |
|
|
315
|
-
| systems: confidence AUROC (n answers) | scikit-learn |
|
|
316
|
-
| systems: distribution-shift drop, Welch CI (n scores) | SciPy |
|
|
317
|
-
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema |
|
|
318
|
-
| systems: latency p50 / p95 / p99 (n requests) | NumPy |
|
|
319
|
-
| systems: maintainability index (1000 programs) | radon |
|
|
320
|
-
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU |
|
|
321
|
-
| text: METEOR, exact and stem matches (10000 sentences) | NLTK |
|
|
322
|
-
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score |
|
|
298
|
+
| 10 classes: macro F1 | scikit-learn | 9.2 | 106.2 | **11.5×** |
|
|
299
|
+
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.7 | 3.6 | **2.1×** |
|
|
300
|
+
| binary: 8 label metrics via evaluate() | scikit-learn | 10.0 | 932.8 | **93.4×** |
|
|
301
|
+
| binary: ROC AUC | scikit-learn | 86.2 | 305.1 | **3.5×** |
|
|
302
|
+
| calibration: slope and intercept | statsmodels | 209.6 | 1146.2 | **5.5×** |
|
|
303
|
+
| clinical: diagnostic report (7 CIs) | statsmodels | 5.2 | 5.9 | **1.1×** |
|
|
304
|
+
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 20.9 | 381.9 | **18.3×** |
|
|
305
|
+
| decision curve: 99 thresholds | NumPy loop | 145.7 | 190.2 | **1.3×** |
|
|
306
|
+
| detection: COCO evaluation (1000 images) | pycocotools | 37.2 | 731.1 | **19.7×** |
|
|
307
|
+
| multiple testing: Hochberg (n p-values) | statsmodels | 74.3 | 79.7 | **1.1×** |
|
|
308
|
+
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 7.9 | 13.4 | **1.7×** |
|
|
309
|
+
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 156.1 | 583.6 | **3.7×** |
|
|
310
|
+
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 36.1 | 248.7 | **6.9×** |
|
|
311
|
+
| segmentation: Hausdorff distance (50 images) | SciPy | 4.6 | 16.6 | **3.6×** |
|
|
312
|
+
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.4×** |
|
|
313
|
+
| statistics: Mann–Whitney U | SciPy | 135.5 | 303.6 | **2.2×** |
|
|
314
|
+
| statistics: Welch t-test | SciPy | 7.1 | 10.4 | **1.5×** |
|
|
315
|
+
| structured: JSON Schema compliance (10000 documents) | jsonschema | 103.6 | 211.7 | **2.0×** |
|
|
316
|
+
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 334.9 | 592.4 | **1.8×** |
|
|
317
|
+
| systems: confidence AUROC (n answers) | scikit-learn | 162.4 | 265.7 | **1.6×** |
|
|
318
|
+
| systems: distribution-shift drop, Welch CI (n scores) | SciPy | 8.4 | 9.6 | **1.1×** |
|
|
319
|
+
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 108.1 | 252.4 | **2.3×** |
|
|
320
|
+
| systems: latency p50 / p95 / p99 (n requests) | NumPy | 13.2 | 15.0 | **1.1×** |
|
|
321
|
+
| systems: maintainability index (1000 programs) | radon | 100.8 | 89.5 | 0.89× |
|
|
322
|
+
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 206.2 | 2405.2 | **11.7×** |
|
|
323
|
+
| text: METEOR, exact and stem matches (10000 sentences) | NLTK | 72.2 | 404.0 | **5.6×** |
|
|
324
|
+
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 179.5 | 678.9 | **3.8×** |
|
|
323
325
|
|
|
324
326
|
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
|
|
325
327
|
statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
|
|
326
328
|
independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
|
|
327
|
-
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.
|
|
329
|
+
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.64×** (171 of 172
|
|
328
330
|
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
329
331
|
|
|
330
|
-
**
|
|
331
|
-
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation)
|
|
332
|
-
|
|
332
|
+
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
333
|
+
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
334
|
+
ROC AUC and average precision (one sort per column, shared by both inside `evaluate()`), the LLM-systems
|
|
335
|
+
consistency, groundedness, citation, toxicity and exposure metrics, Elo ratings, bootstrap resampling (including
|
|
336
|
+
whole bootstrap and jackknife runs of ROC AUC / AP), DeLong, QA exact match and F1,
|
|
337
|
+
Hausdorff and surface distances, calibration bins and the WEAT permutation test run in the compiled,
|
|
338
|
+
multithreaded Rust core; bootstrap intervals, paired bootstrap tests and
|
|
333
339
|
`compare()` evaluate confusion-matrix metrics from counts of each resample's (true, predicted) pairs instead of
|
|
334
340
|
copies of the data. `evaluate()` validates inputs once and builds the confusion
|
|
335
341
|
matrix once for all metrics, and integer labels are encoded without sorting. The rank tests rank the data once
|
|
@@ -35,14 +35,14 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
|
35
35
|
|
|
36
36
|
[[package]]
|
|
37
37
|
name = "evalsuite-core"
|
|
38
|
-
version = "0.
|
|
38
|
+
version = "0.7.1"
|
|
39
39
|
dependencies = [
|
|
40
40
|
"rayon",
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
[[package]]
|
|
44
44
|
name = "evalsuite-py"
|
|
45
|
-
version = "0.
|
|
45
|
+
version = "0.7.1"
|
|
46
46
|
dependencies = [
|
|
47
47
|
"evalsuite-core",
|
|
48
48
|
"pyo3",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//! Pairwise-preference kernels: sequential Elo and the Bradley–Terry win matrix, as EvalSuite's Python reference (`text/judge.py`).
|
|
2
|
+
|
|
3
|
+
/// Sequential Elo ratings. `rows` are (a, b, outcome for a); returns the final ratings of `m` players.
|
|
4
|
+
pub fn elo(
|
|
5
|
+
rows: &[(usize, usize, f64)],
|
|
6
|
+
m: usize,
|
|
7
|
+
k: f64,
|
|
8
|
+
initial: f64,
|
|
9
|
+
scale: f64,
|
|
10
|
+
base: f64,
|
|
11
|
+
) -> Vec<f64> {
|
|
12
|
+
let mut r = vec![initial; m];
|
|
13
|
+
for &(a, b, o) in rows {
|
|
14
|
+
let ea = 1.0 / (1.0 + base.powf((r[b] - r[a]) / scale));
|
|
15
|
+
r[a] += k * (o - ea);
|
|
16
|
+
r[b] += k * ((1.0 - o) - (1.0 - ea));
|
|
17
|
+
}
|
|
18
|
+
r
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/// Bradley–Terry win matrix (row-major m × m): wins[a][b] += o and wins[b][a] += 1 − o for every row, in order.
|
|
22
|
+
pub fn win_matrix(rows: &[(usize, usize, f64)], m: usize) -> Vec<f64> {
|
|
23
|
+
let mut w = vec![0.0f64; m * m];
|
|
24
|
+
for &(a, b, o) in rows {
|
|
25
|
+
w[a * m + b] += o;
|
|
26
|
+
w[b * m + a] += 1.0 - o;
|
|
27
|
+
}
|
|
28
|
+
w
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[cfg(test)]
|
|
32
|
+
mod tests {
|
|
33
|
+
#[test]
|
|
34
|
+
fn elo_symmetric() {
|
|
35
|
+
let r = super::elo(&[(0, 1, 1.0)], 2, 4.0, 1000.0, 400.0, 10.0);
|
|
36
|
+
assert_eq!(r, vec![1002.0, 998.0]);
|
|
37
|
+
}
|
|
38
|
+
}
|