evalsuite-python 0.6.0__tar.gz → 0.7.0__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.0 → evalsuite_python-0.7.0}/CHANGELOG.md +51 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/PKG-INFO +49 -36
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/README.md +48 -35
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/Cargo.lock +57 -2
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/Cargo.toml +1 -1
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/Cargo.toml +1 -0
- evalsuite_python-0.7.0/rust/evalsuite-core/src/agreement.rs +38 -0
- evalsuite_python-0.7.0/rust/evalsuite-core/src/coco.rs +325 -0
- evalsuite_python-0.7.0/rust/evalsuite-core/src/curve.rs +118 -0
- evalsuite_python-0.7.0/rust/evalsuite-core/src/groups.rs +101 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/src/lib.rs +3 -0
- evalsuite_python-0.7.0/rust/evalsuite-core/src/resample.rs +162 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/src/text.rs +247 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-py/Cargo.toml +1 -0
- evalsuite_python-0.7.0/rust/evalsuite-py/src/lib.rs +684 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/_native.py +5 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/classification/metrics.py +76 -1
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/_common.py +34 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/code.py +10 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/longcontext.py +30 -11
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/multilingual.py +17 -8
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/robustness.py +23 -12
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/safety.py +31 -6
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/compare.py +5 -2
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/intervals.py +62 -15
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/paired.py +6 -1
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/factuality.py +10 -1
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/generation.py +22 -6
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/judge.py +18 -9
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/reasoning.py +21 -6
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/version.py +1 -1
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/vision/detection.py +48 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/test_native.py +206 -5
- evalsuite_python-0.6.0/rust/evalsuite-core/src/coco.rs +0 -66
- evalsuite_python-0.6.0/rust/evalsuite-core/src/resample.rs +0 -40
- evalsuite_python-0.6.0/rust/evalsuite-py/src/lib.rs +0 -328
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/CONTRIBUTING.md +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/LICENSE +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/LICENSE-APACHE +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/pyproject.toml +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/README.md +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/src/hash.rs +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/src/meteor.rs +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/rust/evalsuite-core/src/ter.rs +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/__main__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/_bench_metrics.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/_lazy.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/api.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/benchmarks.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/calibration.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/classification/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/classification/_common.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/cli/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/cli/main.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/clinical/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/clinical/metrics.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/clinical/report.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/context.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/exceptions.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/export.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/registry.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/result.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/types.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/core/validation.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/agents.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/efficiency.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/llmsys/uncertainty.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/plot.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/py.typed +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/regression/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/regression/metrics.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/reporting.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/_resolve.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/effect.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/hypothesis.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/stats/results.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/_common.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/qa.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/rag.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/report.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/retrieval.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/semantic.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/spice.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/text/structured.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/vision/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/src/evalsuite/vision/segmentation.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/classification/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/classification/test_against_sklearn.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/clinical/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/clinical/test_outputs.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/clinical/test_v020.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/conftest.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/integration/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/integration/test_qa.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/integration/test_readme_examples.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/integration/test_repo_hygiene.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_code_longcontext_efficiency.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_edges.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_fast_text.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_hardening.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_safety_robustness.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/llmsys/test_uncertainty_agents_multilingual.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/output/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/output/test_benchmarks.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/output/test_cli.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/output/test_plot.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/output/test_reporting.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/regression/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/regression/test_against_sklearn.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/stats/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/stats/test_branches.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/stats/test_compare.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/stats/test_fast_paths.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/stats/test_reference.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/text/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/text/test_against_references.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/text/test_text_edges.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/text/test_v040.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/unit/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/unit/test_core.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/unit/test_edges.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/vision/__init__.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/vision/test_detection.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/vision/test_edges.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/vision/test_outputs.py +0 -0
- {evalsuite_python-0.6.0 → evalsuite_python-0.7.0}/tests/vision/test_segmentation.py +0 -0
|
@@ -6,6 +6,57 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.7.0] - 2026-11-24
|
|
10
|
+
|
|
11
|
+
More of EvalSuite runs in the compiled Rust core. Every result is unchanged: each new kernel is bit-identical to
|
|
12
|
+
the Python implementation it replaces (checked by `tests/test_native.py`), which stays as the fallback.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **ROC AUC and average precision** in the core: one stable sort per column, columns in parallel, with NumPy's
|
|
16
|
+
pairwise summation reproduced exactly. `evaluate()` now shares that sort between ROC AUC and average precision
|
|
17
|
+
(cached on its context), so it sorts each probability column once instead of twice. `evaluate()` with
|
|
18
|
+
probabilities: 2.5× faster (binary) to 4.3× (5-class, 1M samples); `roc_auc` 2.6×, `average_precision` 2×.
|
|
19
|
+
- **LLM-systems consistency metrics** (`paraphrase_consistency`, `response_stability`,
|
|
20
|
+
`cross_document_consistency`, `cross_lingual_consistency`, `majority_vote_accuracy`): answer groups are
|
|
21
|
+
counted in the core (equal pairs from answer counts, O(m) instead of O(m²) pair comparisons): 1.4–4.8×.
|
|
22
|
+
- **Rows of numbers read directly by the core** (no per-row NumPy arrays): `groundedness` 5×,
|
|
23
|
+
`citation_coverage` 7.8×, `toxicity_score` 6×, `exposure` 3×.
|
|
24
|
+
- **Pairwise preferences**: sequential `elo_ratings` 3.6×, and the Bradley–Terry win matrix.
|
|
25
|
+
- Parity tests for every new kernel (ties, sample weights, micro/macro/weighted/per-class, one-vs-one,
|
|
26
|
+
non-string answers, invalid inputs raising the same errors).
|
|
27
|
+
|
|
28
|
+
### Not ported, on purpose
|
|
29
|
+
- Retrieval metrics: already 11–15× faster than ranx in Python; mapping document ids to the core cost more than
|
|
30
|
+
it saved.
|
|
31
|
+
- Krippendorff's alpha: already one vectorised NumPy pass; a compiled version was only 1.5× faster and could not
|
|
32
|
+
reproduce NumPy's matrix-multiply rounding, so results would have changed in the last digit.
|
|
33
|
+
- Fleiss' kappa and judge agreement are single vectorised integer passes; metrics built on Python's `ast`, JSON
|
|
34
|
+
or regular expressions (syntax validity, tool-call keys, answer normalisation) stay in Python.
|
|
35
|
+
|
|
36
|
+
## [0.6.1] - 2026-11-24
|
|
37
|
+
|
|
38
|
+
Finishes the Rust port. Results are unchanged (bit-identical to the Python reference) unless you opt in to
|
|
39
|
+
`resampling="native"`.
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- Whole COCO evaluation in the core: IoU matrices (with the crowd rule), stable descending score sort, ignored
|
|
43
|
+
ground truth, greedy matching, precision/recall accumulation and the 101-point interpolation, in parallel
|
|
44
|
+
over classes (`detection_report`, `mean_average_precision`).
|
|
45
|
+
- Compiled CIDEr-D, CodeBLEU (n-gram and keyword-weighted n-gram terms) and distinct-n.
|
|
46
|
+
- Multithreading: every per-example kernel (BLEU, chrF, TER, ROUGE, METEOR, CIDEr, CodeBLEU, COCO, resample
|
|
47
|
+
counting) runs on all cores; `EVALSUITE_NUM_THREADS` caps the threads. Sums stay in example order, so the
|
|
48
|
+
thread count never changes a result.
|
|
49
|
+
- Opt-in `resampling="native"` for `bootstrap_ci`, `paired_bootstrap_test` and `compare`: resample indices are
|
|
50
|
+
drawn in the core (seeded xoshiro256++, one stream per resample, written straight into the index array).
|
|
51
|
+
About 3× faster bootstrap on 100,000 observations; reproducible with `random_state` and independent of the
|
|
52
|
+
thread count, but a different random stream from the default `"numpy"`. The default is unchanged.
|
|
53
|
+
- Parity tests for the new kernels, tied scores and user areas in COCO, thread-count invariance and native
|
|
54
|
+
resampling.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
- The ported float sums follow the running interpreter's built-in `sum()` (compensated summation on Python
|
|
58
|
+
3.12+, sequential before), so CIDEr and CodeBLEU agree with the Python path to the last bit on every Python.
|
|
59
|
+
|
|
9
60
|
## [0.6.0] - 2026-11-24
|
|
10
61
|
|
|
11
62
|
EvalSuite now has a **compiled core written in Rust**. The public API is unchanged and every result is identical:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: Intended Audience :: Healthcare Industry
|
|
@@ -85,9 +85,11 @@ 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.
|
|
89
|
-
> **0.6
|
|
90
|
-
> bootstrap resampling several times faster (prebuilt wheels for Linux, macOS and Windows).
|
|
88
|
+
> **Status: stable (0.7.0).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
89
|
+
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
90
|
+
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
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.
|
|
91
93
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
92
94
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
93
95
|
|
|
@@ -109,6 +111,13 @@ is needed. Anywhere else pip falls back to a pure-Python wheel that gives exactl
|
|
|
109
111
|
`evalsuite._native.backend()` says which one is in use (`"rust"` or `"python"`), and
|
|
110
112
|
`EVALSUITE_PURE_PYTHON=1` selects the Python implementations on any install.
|
|
111
113
|
|
|
114
|
+
The core runs independent examples (sentences, images, classes, resamples) in parallel on all CPU cores; set
|
|
115
|
+
`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`) accept
|
|
117
|
+
`resampling="native"` to draw resample indices in the core (seeded xoshiro256++): reproducible with
|
|
118
|
+
`random_state` and faster on large inputs, but a different random stream from the default NumPy one, so the
|
|
119
|
+
interval endpoints differ slightly (statistically equivalent).
|
|
120
|
+
|
|
112
121
|
## Why EvalSuite
|
|
113
122
|
|
|
114
123
|
- **One consistent API.** Every metric returns a result object that behaves like a number and exports to
|
|
@@ -349,51 +358,55 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
|
|
|
349
358
|
|
|
350
359
|
## Performance
|
|
351
360
|
|
|
352
|
-
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.
|
|
361
|
+
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.7.0, Python 3.13,
|
|
353
362
|
NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
|
|
354
|
-
difference 2.
|
|
355
|
-
|
|
363
|
+
difference 2.5e-14), 79 are faster (the other 2 are Hochberg correction at 1,000,000 p-values, 0.8–1.05× statsmodels across runs,
|
|
364
|
+
and latency percentiles, within timing noise of NumPy), and the geometric-mean speed-up across all
|
|
365
|
+
27 cases and three sizes is **4.22×**. At 1,000,000 samples (pixels for
|
|
356
366
|
segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
|
|
357
367
|
alphabetical order:
|
|
358
368
|
|
|
359
369
|
| Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
|
|
360
370
|
| --- | --- | ---: | ---: | ---: |
|
|
361
|
-
| 10 classes: macro F1 | scikit-learn |
|
|
362
|
-
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.3 | 2.
|
|
363
|
-
| binary: 8 label metrics via evaluate() | scikit-learn |
|
|
364
|
-
| binary: ROC AUC | scikit-learn |
|
|
365
|
-
| calibration: slope and intercept | statsmodels |
|
|
366
|
-
| clinical: diagnostic report (7 CIs) | statsmodels | 4.
|
|
367
|
-
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn |
|
|
368
|
-
| decision curve: 99 thresholds | NumPy loop |
|
|
369
|
-
| detection: COCO evaluation (1000 images) | pycocotools |
|
|
370
|
-
| multiple testing: Hochberg (n p-values) | statsmodels |
|
|
371
|
-
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn |
|
|
372
|
-
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx |
|
|
373
|
-
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn |
|
|
374
|
-
| segmentation: Hausdorff distance (50 images) | SciPy |
|
|
371
|
+
| 10 classes: macro F1 | scikit-learn | 7.1 | 109.5 | **15.5×** |
|
|
372
|
+
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.3 | 2.7 | **2.2×** |
|
|
373
|
+
| binary: 8 label metrics via evaluate() | scikit-learn | 9.8 | 860.9 | **87.6×** |
|
|
374
|
+
| binary: ROC AUC | scikit-learn | 84.8 | 267.7 | **3.2×** |
|
|
375
|
+
| calibration: slope and intercept | statsmodels | 179.6 | 946.7 | **5.3×** |
|
|
376
|
+
| clinical: diagnostic report (7 CIs) | statsmodels | 4.4 | 4.7 | **1.1×** |
|
|
377
|
+
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 17.7 | 328.1 | **18.5×** |
|
|
378
|
+
| decision curve: 99 thresholds | NumPy loop | 133.1 | 168.4 | **1.3×** |
|
|
379
|
+
| detection: COCO evaluation (1000 images) | pycocotools | 30.3 | 616.3 | **20.4×** |
|
|
380
|
+
| multiple testing: Hochberg (n p-values) | statsmodels | 86.4 | 69.9 | 0.81× |
|
|
381
|
+
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 6.2 | 9.9 | **1.6×** |
|
|
382
|
+
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 118.3 | 577.6 | **4.9×** |
|
|
383
|
+
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 29.3 | 215.2 | **7.3×** |
|
|
384
|
+
| segmentation: Hausdorff distance (50 images) | SciPy | 8.7 | 14.1 | **1.6×** |
|
|
375
385
|
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.0×** |
|
|
376
|
-
| statistics: Mann–Whitney U | SciPy |
|
|
377
|
-
| statistics: Welch t-test | SciPy |
|
|
378
|
-
| structured: JSON Schema compliance (10000 documents) | jsonschema |
|
|
379
|
-
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu |
|
|
380
|
-
| systems: confidence AUROC (n answers) | scikit-learn |
|
|
381
|
-
| systems: distribution-shift drop, Welch CI (n scores) | SciPy |
|
|
382
|
-
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema |
|
|
383
|
-
| systems: latency p50 / p95 / p99 (n requests) | NumPy |
|
|
384
|
-
| systems: maintainability index (1000 programs) | radon |
|
|
385
|
-
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU |
|
|
386
|
-
| text: METEOR, exact and stem matches (10000 sentences) | NLTK |
|
|
387
|
-
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score |
|
|
386
|
+
| statistics: Mann–Whitney U | SciPy | 115.1 | 305.0 | **2.6×** |
|
|
387
|
+
| statistics: Welch t-test | SciPy | 4.9 | 7.2 | **1.5×** |
|
|
388
|
+
| structured: JSON Schema compliance (10000 documents) | jsonschema | 100.6 | 224.3 | **2.2×** |
|
|
389
|
+
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 313.9 | 511.3 | **1.6×** |
|
|
390
|
+
| systems: confidence AUROC (n answers) | scikit-learn | 181.2 | 279.3 | **1.5×** |
|
|
391
|
+
| systems: distribution-shift drop, Welch CI (n scores) | SciPy | 8.6 | 9.8 | **1.1×** |
|
|
392
|
+
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 109.2 | 219.3 | **2.0×** |
|
|
393
|
+
| systems: latency p50 / p95 / p99 (n requests) | NumPy | 12.9 | 12.5 | 0.97× |
|
|
394
|
+
| systems: maintainability index (1000 programs) | radon | 88.6 | 98.7 | **1.1×** |
|
|
395
|
+
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 165.0 | 2030.3 | **12.3×** |
|
|
396
|
+
| text: METEOR, exact and stem matches (10000 sentences) | NLTK | 63.8 | 363.8 | **5.7×** |
|
|
397
|
+
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 152.8 | 613.6 | **4.0×** |
|
|
388
398
|
|
|
389
399
|
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
|
|
390
400
|
statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
|
|
391
401
|
independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
|
|
392
|
-
comparisons agree**, and against the libraries the geometric-mean speed-up is **
|
|
402
|
+
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.44×** (172 of 172
|
|
393
403
|
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
394
404
|
|
|
395
|
-
**
|
|
396
|
-
|
|
405
|
+
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
406
|
+
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
407
|
+
ROC AUC and average precision (one sort per column, shared by both inside `evaluate()`), the LLM-systems
|
|
408
|
+
consistency, groundedness, citation, toxicity and exposure metrics, Elo ratings and bootstrap resampling run in
|
|
409
|
+
the compiled, multithreaded Rust core; bootstrap intervals, paired bootstrap tests and
|
|
397
410
|
`compare()` evaluate confusion-matrix metrics from counts of each resample's (true, predicted) pairs instead of
|
|
398
411
|
copies of the data. `evaluate()` validates inputs once and builds the confusion
|
|
399
412
|
matrix once for all metrics, and integer labels are encoded without sorting. The rank tests rank the data once
|
|
@@ -10,9 +10,11 @@
|
|
|
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.
|
|
14
|
-
> **0.6
|
|
15
|
-
> bootstrap resampling several times faster (prebuilt wheels for Linux, macOS and Windows).
|
|
13
|
+
> **Status: stable (0.7.0).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
14
|
+
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
15
|
+
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
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.
|
|
16
18
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
17
19
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
18
20
|
|
|
@@ -34,6 +36,13 @@ is needed. Anywhere else pip falls back to a pure-Python wheel that gives exactl
|
|
|
34
36
|
`evalsuite._native.backend()` says which one is in use (`"rust"` or `"python"`), and
|
|
35
37
|
`EVALSUITE_PURE_PYTHON=1` selects the Python implementations on any install.
|
|
36
38
|
|
|
39
|
+
The core runs independent examples (sentences, images, classes, resamples) in parallel on all CPU cores; set
|
|
40
|
+
`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`) accept
|
|
42
|
+
`resampling="native"` to draw resample indices in the core (seeded xoshiro256++): reproducible with
|
|
43
|
+
`random_state` and faster on large inputs, but a different random stream from the default NumPy one, so the
|
|
44
|
+
interval endpoints differ slightly (statistically equivalent).
|
|
45
|
+
|
|
37
46
|
## Why EvalSuite
|
|
38
47
|
|
|
39
48
|
- **One consistent API.** Every metric returns a result object that behaves like a number and exports to
|
|
@@ -274,51 +283,55 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
|
|
|
274
283
|
|
|
275
284
|
## Performance
|
|
276
285
|
|
|
277
|
-
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.
|
|
286
|
+
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.7.0, Python 3.13,
|
|
278
287
|
NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
|
|
279
|
-
difference 2.
|
|
280
|
-
|
|
288
|
+
difference 2.5e-14), 79 are faster (the other 2 are Hochberg correction at 1,000,000 p-values, 0.8–1.05× statsmodels across runs,
|
|
289
|
+
and latency percentiles, within timing noise of NumPy), and the geometric-mean speed-up across all
|
|
290
|
+
27 cases and three sizes is **4.22×**. At 1,000,000 samples (pixels for
|
|
281
291
|
segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
|
|
282
292
|
alphabetical order:
|
|
283
293
|
|
|
284
294
|
| Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
|
|
285
295
|
| --- | --- | ---: | ---: | ---: |
|
|
286
|
-
| 10 classes: macro F1 | scikit-learn |
|
|
287
|
-
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.3 | 2.
|
|
288
|
-
| binary: 8 label metrics via evaluate() | scikit-learn |
|
|
289
|
-
| binary: ROC AUC | scikit-learn |
|
|
290
|
-
| calibration: slope and intercept | statsmodels |
|
|
291
|
-
| clinical: diagnostic report (7 CIs) | statsmodels | 4.
|
|
292
|
-
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn |
|
|
293
|
-
| decision curve: 99 thresholds | NumPy loop |
|
|
294
|
-
| detection: COCO evaluation (1000 images) | pycocotools |
|
|
295
|
-
| multiple testing: Hochberg (n p-values) | statsmodels |
|
|
296
|
-
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn |
|
|
297
|
-
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx |
|
|
298
|
-
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn |
|
|
299
|
-
| segmentation: Hausdorff distance (50 images) | SciPy |
|
|
296
|
+
| 10 classes: macro F1 | scikit-learn | 7.1 | 109.5 | **15.5×** |
|
|
297
|
+
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.3 | 2.7 | **2.2×** |
|
|
298
|
+
| binary: 8 label metrics via evaluate() | scikit-learn | 9.8 | 860.9 | **87.6×** |
|
|
299
|
+
| binary: ROC AUC | scikit-learn | 84.8 | 267.7 | **3.2×** |
|
|
300
|
+
| calibration: slope and intercept | statsmodels | 179.6 | 946.7 | **5.3×** |
|
|
301
|
+
| clinical: diagnostic report (7 CIs) | statsmodels | 4.4 | 4.7 | **1.1×** |
|
|
302
|
+
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 17.7 | 328.1 | **18.5×** |
|
|
303
|
+
| decision curve: 99 thresholds | NumPy loop | 133.1 | 168.4 | **1.3×** |
|
|
304
|
+
| detection: COCO evaluation (1000 images) | pycocotools | 30.3 | 616.3 | **20.4×** |
|
|
305
|
+
| multiple testing: Hochberg (n p-values) | statsmodels | 86.4 | 69.9 | 0.81× |
|
|
306
|
+
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 6.2 | 9.9 | **1.6×** |
|
|
307
|
+
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 118.3 | 577.6 | **4.9×** |
|
|
308
|
+
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 29.3 | 215.2 | **7.3×** |
|
|
309
|
+
| segmentation: Hausdorff distance (50 images) | SciPy | 8.7 | 14.1 | **1.6×** |
|
|
300
310
|
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.0×** |
|
|
301
|
-
| statistics: Mann–Whitney U | SciPy |
|
|
302
|
-
| statistics: Welch t-test | SciPy |
|
|
303
|
-
| structured: JSON Schema compliance (10000 documents) | jsonschema |
|
|
304
|
-
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu |
|
|
305
|
-
| systems: confidence AUROC (n answers) | scikit-learn |
|
|
306
|
-
| systems: distribution-shift drop, Welch CI (n scores) | SciPy |
|
|
307
|
-
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema |
|
|
308
|
-
| systems: latency p50 / p95 / p99 (n requests) | NumPy |
|
|
309
|
-
| systems: maintainability index (1000 programs) | radon |
|
|
310
|
-
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU |
|
|
311
|
-
| text: METEOR, exact and stem matches (10000 sentences) | NLTK |
|
|
312
|
-
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score |
|
|
311
|
+
| statistics: Mann–Whitney U | SciPy | 115.1 | 305.0 | **2.6×** |
|
|
312
|
+
| statistics: Welch t-test | SciPy | 4.9 | 7.2 | **1.5×** |
|
|
313
|
+
| structured: JSON Schema compliance (10000 documents) | jsonschema | 100.6 | 224.3 | **2.2×** |
|
|
314
|
+
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 313.9 | 511.3 | **1.6×** |
|
|
315
|
+
| systems: confidence AUROC (n answers) | scikit-learn | 181.2 | 279.3 | **1.5×** |
|
|
316
|
+
| systems: distribution-shift drop, Welch CI (n scores) | SciPy | 8.6 | 9.8 | **1.1×** |
|
|
317
|
+
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 109.2 | 219.3 | **2.0×** |
|
|
318
|
+
| systems: latency p50 / p95 / p99 (n requests) | NumPy | 12.9 | 12.5 | 0.97× |
|
|
319
|
+
| systems: maintainability index (1000 programs) | radon | 88.6 | 98.7 | **1.1×** |
|
|
320
|
+
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 165.0 | 2030.3 | **12.3×** |
|
|
321
|
+
| text: METEOR, exact and stem matches (10000 sentences) | NLTK | 63.8 | 363.8 | **5.7×** |
|
|
322
|
+
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 152.8 | 613.6 | **4.0×** |
|
|
313
323
|
|
|
314
324
|
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
|
|
315
325
|
statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
|
|
316
326
|
independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
|
|
317
|
-
comparisons agree**, and against the libraries the geometric-mean speed-up is **
|
|
327
|
+
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.44×** (172 of 172
|
|
318
328
|
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
319
329
|
|
|
320
|
-
**
|
|
321
|
-
|
|
330
|
+
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
331
|
+
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
332
|
+
ROC AUC and average precision (one sort per column, shared by both inside `evaluate()`), the LLM-systems
|
|
333
|
+
consistency, groundedness, citation, toxicity and exposure metrics, Elo ratings and bootstrap resampling run in
|
|
334
|
+
the compiled, multithreaded Rust core; bootstrap intervals, paired bootstrap tests and
|
|
322
335
|
`compare()` evaluate confusion-matrix metrics from counts of each resample's (true, predicted) pairs instead of
|
|
323
336
|
copies of the data. `evaluate()` validates inputs once and builds the confusion
|
|
324
337
|
matrix once for all metrics, and integer labels are encoded without sorting. The rank tests rank the data once
|
|
@@ -2,16 +2,51 @@
|
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
3
|
version = 3
|
|
4
4
|
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "crossbeam-deque"
|
|
7
|
+
version = "0.8.8"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"crossbeam-epoch",
|
|
12
|
+
"crossbeam-utils",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[[package]]
|
|
16
|
+
name = "crossbeam-epoch"
|
|
17
|
+
version = "0.9.21"
|
|
18
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
19
|
+
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"crossbeam-utils",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[[package]]
|
|
25
|
+
name = "crossbeam-utils"
|
|
26
|
+
version = "0.8.23"
|
|
27
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
28
|
+
checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "either"
|
|
32
|
+
version = "1.19.0"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
35
|
+
|
|
5
36
|
[[package]]
|
|
6
37
|
name = "evalsuite-core"
|
|
7
|
-
version = "0.
|
|
38
|
+
version = "0.7.0"
|
|
39
|
+
dependencies = [
|
|
40
|
+
"rayon",
|
|
41
|
+
]
|
|
8
42
|
|
|
9
43
|
[[package]]
|
|
10
44
|
name = "evalsuite-py"
|
|
11
|
-
version = "0.
|
|
45
|
+
version = "0.7.0"
|
|
12
46
|
dependencies = [
|
|
13
47
|
"evalsuite-core",
|
|
14
48
|
"pyo3",
|
|
49
|
+
"rayon",
|
|
15
50
|
]
|
|
16
51
|
|
|
17
52
|
[[package]]
|
|
@@ -113,6 +148,26 @@ dependencies = [
|
|
|
113
148
|
"proc-macro2",
|
|
114
149
|
]
|
|
115
150
|
|
|
151
|
+
[[package]]
|
|
152
|
+
name = "rayon"
|
|
153
|
+
version = "1.12.0"
|
|
154
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
155
|
+
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
|
156
|
+
dependencies = [
|
|
157
|
+
"either",
|
|
158
|
+
"rayon-core",
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
[[package]]
|
|
162
|
+
name = "rayon-core"
|
|
163
|
+
version = "1.13.0"
|
|
164
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
165
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
166
|
+
dependencies = [
|
|
167
|
+
"crossbeam-deque",
|
|
168
|
+
"crossbeam-utils",
|
|
169
|
+
]
|
|
170
|
+
|
|
116
171
|
[[package]]
|
|
117
172
|
name = "syn"
|
|
118
173
|
version = "3.0.10"
|
|
@@ -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
|
+
}
|