evalsuite-python 1.1.2__tar.gz → 1.2.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-1.1.2 → evalsuite_python-1.2.1}/CHANGELOG.md +72 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/PKG-INFO +117 -7
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/README.md +112 -6
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/pyproject.toml +5 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/Cargo.lock +6 -6
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/Cargo.toml +1 -1
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/lib.rs +1 -0
- evalsuite_python-1.2.1/rust/evalsuite-core/src/survival.rs +84 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-py/src/lib.rs +67 -1
- evalsuite_python-1.2.1/src/evalsuite/__init__.py +950 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/_evalci.py +137 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/_native.py +1 -1
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/_update.py +2 -1
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/api.py +5 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/cli/main.py +40 -1
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/registry.py +24 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/result.py +17 -7
- evalsuite_python-1.2.1/src/evalsuite/fairness.py +395 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/harness.py +35 -2
- evalsuite_python-1.2.1/src/evalsuite/html_report.py +150 -0
- evalsuite_python-1.2.1/src/evalsuite/judging.py +527 -0
- evalsuite_python-1.2.1/src/evalsuite/llm_benchmarks.py +193 -0
- evalsuite_python-1.2.1/src/evalsuite/rag_report.py +241 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/intervals.py +267 -0
- evalsuite_python-1.2.1/src/evalsuite/stats/planning.py +340 -0
- evalsuite_python-1.2.1/src/evalsuite/survival.py +413 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/judge.py +36 -29
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/version.py +1 -1
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/integration/test_readme_examples.py +1 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_update.py +3 -1
- evalsuite_python-1.2.1/tests/test_v12.py +325 -0
- evalsuite_python-1.2.1/tests/test_v121.py +181 -0
- evalsuite_python-1.2.1/tests/test_v121_coverage.py +222 -0
- evalsuite_python-1.1.2/src/evalsuite/__init__.py +0 -292
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/CONTRIBUTING.md +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/LICENSE +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/LICENSE-APACHE +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/Cargo.toml +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/README.md +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/agreement.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/coco.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/curve.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/groups.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/hash.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/meteor.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/permutation.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/qa.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/ranks.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/resample.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/surface.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/ter.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-core/src/text.rs +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/rust/evalsuite-py/Cargo.toml +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/__main__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/_bench_metrics.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/_lazy.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/benchmarks.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/calibration.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/cards.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/classification/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/classification/_common.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/classification/metrics.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/cli/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/clinical/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/clinical/metrics.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/clinical/report.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/context.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/exceptions.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/export.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/types.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/core/validation.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/integrations.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/_common.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/agents.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/code.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/efficiency.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/longcontext.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/multilingual.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/robustness.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/safety.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/llmsys/uncertainty.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/monitor.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/plot.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/py.typed +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/regression/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/regression/metrics.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/reporting.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/_resolve.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/compare.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/effect.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/hypothesis.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/paired.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/stats/results.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/_common.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/factuality.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/generation.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/qa.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/rag.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/reasoning.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/report.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/retrieval.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/semantic.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/spice.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/text/structured.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/vision/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/vision/detection.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/src/evalsuite/vision/segmentation.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/classification/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/classification/test_against_sklearn.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/clinical/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/clinical/test_outputs.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/clinical/test_v020.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/conftest.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/integration/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/integration/test_qa.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/integration/test_repo_hygiene.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_code_longcontext_efficiency.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_edges.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_fast_text.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_hardening.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_safety_robustness.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/llmsys/test_uncertainty_agents_multilingual.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/output/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/output/test_benchmarks.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/output/test_cli.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/output/test_plot.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/output/test_reporting.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/regression/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/regression/test_against_sklearn.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/stats/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/stats/test_branches.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/stats/test_compare.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/stats/test_fast_paths.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/stats/test_reference.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_cards.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_harness.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_integrations.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_monitor.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_native.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/test_v111_fixes.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/text/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/text/test_against_references.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/text/test_text_edges.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/text/test_v040.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/unit/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/unit/test_core.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/unit/test_edges.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/vision/__init__.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/vision/test_detection.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/vision/test_edges.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/vision/test_outputs.py +0 -0
- {evalsuite_python-1.1.2 → evalsuite_python-1.2.1}/tests/vision/test_segmentation.py +0 -0
|
@@ -6,6 +6,78 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.2.1] - 2026-11-26
|
|
10
|
+
|
|
11
|
+
Faster to import, faster to resample, and a deep clean of the 1.2 modules.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Load only what you use.** `import evalsuite` no longer imports NumPy, SciPy or any EvalSuite module: every
|
|
16
|
+
function, class and submodule is imported the first time it is used (PEP 562). Import time drops from about
|
|
17
|
+
100 ms to about 30 ms and the command line starts in about 55 ms instead of 145 ms. Code is unchanged:
|
|
18
|
+
`es.accuracy`, `from evalsuite import *`, `es.list_metrics()` and IDE completion work as before.
|
|
19
|
+
- **Speed.**
|
|
20
|
+
- Cluster bootstrap (`evaluate(..., clusters=)`, `bootstrap_ci(..., clusters=)`): confusion-matrix metrics
|
|
21
|
+
from per-cluster counts, ROC AUC / average precision and mean losses from cluster multiplicities;
|
|
22
|
+
`bootstrap_ci` about 10× faster and `evaluate` about 3× faster on 100,000 observations.
|
|
23
|
+
- Concordance index in the compiled core: about 29× faster (bit-identical); bootstrap intervals run
|
|
24
|
+
resamples in parallel.
|
|
25
|
+
- `judge_report` Bradley–Terry bootstrap about 10× faster; `fairness_report` about 2× faster.
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- `es.rag_report` and `es.html_report` could become modules instead of functions after their modules were
|
|
30
|
+
imported (lazy loading guards this).
|
|
31
|
+
- `rubric_report` rejects non-numeric or NaN scores with a clear message instead of a raw error or a NaN row.
|
|
32
|
+
- `fairness_report` rejects missing group values instead of silently forming a "None" group.
|
|
33
|
+
- `sample_size_proportion` rejects a half-width of 0.5 or more.
|
|
34
|
+
- Singular wording in reports ("1 comparison", "1 question") and clearer length errors for survival and
|
|
35
|
+
fairness inputs.
|
|
36
|
+
- A power test's tolerance for older SciPy on Python 3.9.
|
|
37
|
+
|
|
38
|
+
## [1.2.0] - 2026-11-26
|
|
39
|
+
|
|
40
|
+
EvalSuite for LLM evaluation and research-grade statistics.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- **LLM benchmark presets**: `es.leaderboard(..., benchmark="gsm8k" | "mmlu" | "arc" | "arc-easy" |
|
|
44
|
+
"truthfulqa" | "humaneval")` sets the scorer; `es.load_benchmark(name)` returns prompts, gold answers and
|
|
45
|
+
categories (MMLU subjects) from the Hugging Face Hub (`[benchmarks]` extra); `es.format_multiple_choice`.
|
|
46
|
+
HumanEval records carry `passed` or `n_samples` / `n_correct` from your own sandbox (EvalSuite never runs
|
|
47
|
+
model-generated code). `evalsuite leaderboard --benchmark`.
|
|
48
|
+
- **`es.judge_report`**: win rates (Wilson) and Bradley–Terry ratings (bootstrap) from pairwise verdicts, with
|
|
49
|
+
position consistency and first-position preference, length bias, self-preference and agreement with human
|
|
50
|
+
verdicts (Cohen's kappa with a bootstrap interval); each bias tested and flagged only when significant.
|
|
51
|
+
**`es.rubric_report`**: rubric means with t intervals, inter-rater Krippendorff's alpha, Spearman
|
|
52
|
+
correlation with human scores.
|
|
53
|
+
- **`es.rag_report`**: hit rate / recall / MRR at k, exact match, token F1 and grounded rate with intervals, and
|
|
54
|
+
every question classified as correct, retrieval failure, generation failure, unsupported-but-correct or
|
|
55
|
+
unknown cause, with the biggest problem named.
|
|
56
|
+
- **`es.html_report`**: one self-contained HTML file (no scripts, no external requests) from any EvalSuite
|
|
57
|
+
results, Matplotlib figures and Markdown text, with a provenance footer.
|
|
58
|
+
- **Planning**: `sample_size_proportion`, `sample_size_two_proportions` (paired McNemar, Connor 1987;
|
|
59
|
+
unpaired, Fleiss et al.), `sample_size_auc` (Hanley & McNeil; Obuchowski), `sample_size_mean_difference`, and
|
|
60
|
+
`power_*` counterparts; checked against statsmodels and by simulation.
|
|
61
|
+
- **Clustered intervals**: `bootstrap_ci(..., clusters=)` and `evaluate(..., clusters=)` resample whole clusters
|
|
62
|
+
(patients, documents, sites) for every interval and paired baseline test; in a simulation with 60 patients
|
|
63
|
+
of 10 scans, 95% intervals covered the truth 93% of the time against 77% for ordinary intervals.
|
|
64
|
+
- **`es.fairness_report`**: per-group selection rate, TPR, FPR, PPV, accuracy (Wilson), ROC AUC (DeLong) and
|
|
65
|
+
calibration-in-the-large; demographic parity difference / ratio, equalized odds, equal opportunity and
|
|
66
|
+
predictive parity gaps with bootstrap intervals; intersectional groups; Fisher tests against a reference
|
|
67
|
+
group, Holm-adjusted. Gap values identical to Fairlearn's.
|
|
68
|
+
- **Survival metrics**: `concordance_index` (Harrell; Uno's IPCW with `ipcw=True`, optional bootstrap
|
|
69
|
+
interval), `time_dependent_auc`, `brier_score_survival`, `integrated_brier_score`, `kaplan_meier`;
|
|
70
|
+
identical to scikit-survival (to 1e-15), Harrell's C 17× faster on 100,000 subjects.
|
|
71
|
+
- **GitHub Action** (`uses: mkcs28/evalsuite-python@v1.2.0`): evaluates a predictions file on every pull
|
|
72
|
+
request, comments metrics with intervals and paired tests (updating its own comment), writes the job summary
|
|
73
|
+
and can fail on a significant regression. The CLI gains `evaluate --baseline-pred/--baseline-prob
|
|
74
|
+
--clusters --ci --fail-on-regression`.
|
|
75
|
+
- CI builds and tests the R package on Windows; an upgrade banner in the README for users of older versions.
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
- `EvaluationResult.to_html()` shows intervals and baseline tests, like the Markdown and LaTeX exports.
|
|
79
|
+
- Per-metric benchmark table (all registered metrics) re-run on 1.2.0.
|
|
80
|
+
|
|
9
81
|
## [1.1.2] - 2026-11-26
|
|
10
82
|
|
|
11
83
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: Intended Audience :: Healthcare Industry
|
|
@@ -26,11 +26,14 @@ Requires-Dist: pandas>=1.4
|
|
|
26
26
|
Requires-Dist: matplotlib>=3.5 ; extra == 'all'
|
|
27
27
|
Requires-Dist: pillow>=9 ; extra == 'all'
|
|
28
28
|
Requires-Dist: nltk>=3.8 ; extra == 'all'
|
|
29
|
+
Requires-Dist: datasets>=2.14 ; extra == 'benchmarks'
|
|
29
30
|
Requires-Dist: pytest>=7 ; extra == 'dev'
|
|
30
31
|
Requires-Dist: pytest-cov>=4 ; extra == 'dev'
|
|
31
32
|
Requires-Dist: hypothesis>=6.80 ; extra == 'dev'
|
|
32
33
|
Requires-Dist: scikit-learn>=1.4 ; extra == 'dev'
|
|
33
34
|
Requires-Dist: statsmodels>=0.13 ; extra == 'dev'
|
|
35
|
+
Requires-Dist: scikit-survival>=0.22 ; python_full_version >= '3.10' and extra == 'dev'
|
|
36
|
+
Requires-Dist: fairlearn>=0.10 ; extra == 'dev'
|
|
34
37
|
Requires-Dist: matplotlib>=3.5 ; extra == 'dev'
|
|
35
38
|
Requires-Dist: pillow>=9 ; extra == 'dev'
|
|
36
39
|
Requires-Dist: pycocotools>=2.0.7 ; extra == 'dev'
|
|
@@ -60,6 +63,7 @@ Requires-Dist: scikit-learn>=1.2 ; extra == 'sklearn'
|
|
|
60
63
|
Requires-Dist: pillow>=9 ; extra == 'vision'
|
|
61
64
|
Requires-Dist: wandb>=0.16 ; extra == 'wandb'
|
|
62
65
|
Provides-Extra: all
|
|
66
|
+
Provides-Extra: benchmarks
|
|
63
67
|
Provides-Extra: dev
|
|
64
68
|
Provides-Extra: docx
|
|
65
69
|
Provides-Extra: keras
|
|
@@ -97,11 +101,22 @@ Project-URL: Source, https://github.com/mkcs28/evalsuite-python
|
|
|
97
101
|
EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
|
|
98
102
|
evaluation into one consistent, validated, documented framework.
|
|
99
103
|
|
|
100
|
-
> **
|
|
104
|
+
> **On an older version? Upgrade once:** `pip install -U evalsuite-python`. From 1.1.2 on, EvalSuite tells you
|
|
105
|
+
> when a newer release is out (`evalsuite upgrade`).
|
|
106
|
+
|
|
107
|
+
> **Status: stable (1.2.1).** [Example notebooks](notebooks/README.md) (Colab) ·
|
|
101
108
|
> [in-browser tools](https://evalsuite-nine.vercel.app/tools) · [changelog](CHANGELOG.md)
|
|
102
109
|
|
|
103
110
|
**What's new**
|
|
104
111
|
|
|
112
|
+
- **1.2.1** — `import evalsuite` loads only what you use (about 30 ms, no NumPy until needed); faster cluster
|
|
113
|
+
bootstrap, concordance index (compiled core), judge and fairness reports; a deep clean of the 1.2 modules.
|
|
114
|
+
- **1.2** — LLM evaluation and research-grade statistics: benchmark presets (GSM8K, MMLU, ARC, TruthfulQA,
|
|
115
|
+
HumanEval) for the leaderboard, a judge report (win rates, position / length / self-preference bias, agreement
|
|
116
|
+
with humans), rubric reports, an end-to-end RAG report that blames each failure on retrieval or generation, a
|
|
117
|
+
single-file HTML report; sample-size and power planning, cluster-bootstrap intervals (`clusters=`), a fairness
|
|
118
|
+
report (gaps with intervals, intersectional groups) and survival metrics (C-index, time-dependent AUC,
|
|
119
|
+
integrated Brier score); a GitHub Action that comments results on pull requests.
|
|
105
120
|
- **1.1.2** — a once-a-day notice when a newer release exists, and a one-command upgrade (`evalsuite upgrade`
|
|
106
121
|
or `es.upgrade()`); every README refreshed with current benchmark numbers.
|
|
107
122
|
- **1.1.1** — hardening: every engine metric fuzzed (no crashes on malformed input), NaN / Infinity preserved in
|
|
@@ -436,6 +451,101 @@ ei.log_mlflow(result)
|
|
|
436
451
|
ei.log_wandb(result)
|
|
437
452
|
```
|
|
438
453
|
|
|
454
|
+
## Planning a test set
|
|
455
|
+
|
|
456
|
+
```python
|
|
457
|
+
es.sample_size_two_proportions(0.80, 0.83, discordance=0.10) # items to detect +3 points between two models
|
|
458
|
+
es.sample_size_proportion(0.9, 0.02) # items for accuracy ± 2 points
|
|
459
|
+
es.sample_size_auc(0.85, prevalence=0.2, half_width=0.03) # positives and negatives for an AUC interval
|
|
460
|
+
es.power_two_proportions(500, 0.80, 0.83, discordance=0.10) # power with the items you have
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## Clustered data
|
|
464
|
+
|
|
465
|
+
Several scans per patient, several questions per document or several sites make ordinary intervals too narrow.
|
|
466
|
+
Pass the cluster of each row and every interval and baseline test resamples whole clusters:
|
|
467
|
+
|
|
468
|
+
```python
|
|
469
|
+
patient = np.repeat(np.arange(40), 5) # 200 rows, 5 per patient
|
|
470
|
+
result = es.evaluate(y_true, y_pred, clusters=patient)
|
|
471
|
+
es.bootstrap_ci("roc_auc", y_true, y_prob=y_prob, clusters=patient)
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Fairness
|
|
475
|
+
|
|
476
|
+
```python
|
|
477
|
+
group = np.where(np.arange(200) % 3 == 0, "A", "B")
|
|
478
|
+
report = es.fairness_report(y_true, y_pred, y_prob, groups={"group": group})
|
|
479
|
+
print(report.summary()) # per-group rates with CIs, parity / equalized-odds gaps with CIs, Holm-adjusted tests
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Several attributes give intersectional groups (`groups={"sex": sex, "age": age}`); gap definitions match
|
|
483
|
+
Fairlearn's.
|
|
484
|
+
|
|
485
|
+
## Survival analysis
|
|
486
|
+
|
|
487
|
+
```python
|
|
488
|
+
time = np.arange(1, 201) * 0.5
|
|
489
|
+
event = np.arange(200) % 4 != 0
|
|
490
|
+
risk = -time + np.sin(np.arange(200))
|
|
491
|
+
es.concordance_index(time, event, risk) # Harrell's C (ipcw=True: Uno's C)
|
|
492
|
+
es.time_dependent_auc(time, event, risk, [20, 40, 60]) # cumulative/dynamic AUC
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
`brier_score_survival` and `integrated_brier_score` take predicted survival probabilities. All agree with
|
|
496
|
+
scikit-survival to 1e-15 (Harrell's C is about 17× faster).
|
|
497
|
+
|
|
498
|
+
## LLM judges, rubrics and RAG
|
|
499
|
+
|
|
500
|
+
```python
|
|
501
|
+
judgements = [
|
|
502
|
+
{"model_a": "m1", "model_b": "m2", "verdict": "A", "verdict_swapped": "A", "length_a": 120, "length_b": 80},
|
|
503
|
+
{"model_a": "m2", "model_b": "m1", "verdict": "B", "verdict_swapped": "tie", "length_a": 60, "length_b": 150},
|
|
504
|
+
{"model_a": "m1", "model_b": "m2", "verdict": "tie", "verdict_swapped": "tie", "length_a": 90, "length_b": 95},
|
|
505
|
+
]
|
|
506
|
+
print(es.judge_report(judgements, n_resamples=200).summary())
|
|
507
|
+
# win rates, Bradley–Terry, position consistency, length bias, self-preference, agreement with humans
|
|
508
|
+
|
|
509
|
+
rag = es.rag_report(
|
|
510
|
+
[
|
|
511
|
+
{"retrieved": ["d1", "d7"], "relevant": ["d1"], "answer": "Paris", "reference": "Paris"},
|
|
512
|
+
{"retrieved": ["d3"], "relevant": ["d2"], "answer": "Rome", "reference": "Oslo"},
|
|
513
|
+
]
|
|
514
|
+
)
|
|
515
|
+
print(rag.summary()) # retrieval / grounding / answer metrics, and each failure blamed on a stage
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Leaderboards know common benchmarks: `es.leaderboard(runs, benchmark="gsm8k", references=es.load_benchmark("gsm8k"))`
|
|
519
|
+
(also `mmlu`, `arc`, `truthfulqa`, `humaneval`; datasets via `pip install "evalsuite-python[benchmarks]"`).
|
|
520
|
+
|
|
521
|
+
## One HTML report
|
|
522
|
+
|
|
523
|
+
```python
|
|
524
|
+
page = es.html_report(
|
|
525
|
+
{"Test set": es.evaluate(y_true, y_pred, y_prob=y_prob), "Notes": "Model v3."},
|
|
526
|
+
title="Model evaluation",
|
|
527
|
+
path="report.html",
|
|
528
|
+
)
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Any EvalSuite result, Matplotlib figure or Markdown text becomes a section of one self-contained file (no
|
|
532
|
+
scripts, no external requests).
|
|
533
|
+
|
|
534
|
+
## Evaluation in pull requests
|
|
535
|
+
|
|
536
|
+
```yaml
|
|
537
|
+
- uses: mkcs28/evalsuite-python@v1.2.1
|
|
538
|
+
with:
|
|
539
|
+
predictions: predictions.csv
|
|
540
|
+
y-true: label
|
|
541
|
+
y-pred: pred
|
|
542
|
+
baseline-pred: base_pred # e.g. the main branch's predictions
|
|
543
|
+
fail-on-regression: "true"
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
The action comments metrics with intervals and paired tests on the pull request and fails it on a significant
|
|
547
|
+
regression ([full example](examples/evalsuite-action.yml)).
|
|
548
|
+
|
|
439
549
|
## Classification report
|
|
440
550
|
|
|
441
551
|
```python
|
|
@@ -532,11 +642,11 @@ metric calls. At 1,000,000 samples (pixels for segmentation; 1,000 images for de
|
|
|
532
642
|
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 219.5 | 889.0 | **4.05×** |
|
|
533
643
|
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 266.7 | 2399.8 | **9.00×** |
|
|
534
644
|
|
|
535
|
-
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`,
|
|
536
|
-
|
|
537
|
-
independent textbook formula and
|
|
538
|
-
comparisons agree**, and against the libraries the geometric-mean
|
|
539
|
-
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
645
|
+
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`, re-run on 1.2.0): all 225 registered
|
|
646
|
+
metrics and statistics functions at 10,000 and 100,000 samples. 82 are compared with a reference library, 118
|
|
647
|
+
with an independent textbook formula and 25 (learned, judge-dependent, randomised, or whose reference library was
|
|
648
|
+
not installed) are timed alone; **all 200 comparisons agree**, and against the libraries the geometric-mean
|
|
649
|
+
speed-up is **5.50×** (164 of 164 measurements faster). Per-metric table in BENCHMARKS.md.
|
|
540
650
|
|
|
541
651
|
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
542
652
|
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
@@ -10,11 +10,22 @@
|
|
|
10
10
|
EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
|
|
11
11
|
evaluation into one consistent, validated, documented framework.
|
|
12
12
|
|
|
13
|
-
> **
|
|
13
|
+
> **On an older version? Upgrade once:** `pip install -U evalsuite-python`. From 1.1.2 on, EvalSuite tells you
|
|
14
|
+
> when a newer release is out (`evalsuite upgrade`).
|
|
15
|
+
|
|
16
|
+
> **Status: stable (1.2.1).** [Example notebooks](notebooks/README.md) (Colab) ·
|
|
14
17
|
> [in-browser tools](https://evalsuite-nine.vercel.app/tools) · [changelog](CHANGELOG.md)
|
|
15
18
|
|
|
16
19
|
**What's new**
|
|
17
20
|
|
|
21
|
+
- **1.2.1** — `import evalsuite` loads only what you use (about 30 ms, no NumPy until needed); faster cluster
|
|
22
|
+
bootstrap, concordance index (compiled core), judge and fairness reports; a deep clean of the 1.2 modules.
|
|
23
|
+
- **1.2** — LLM evaluation and research-grade statistics: benchmark presets (GSM8K, MMLU, ARC, TruthfulQA,
|
|
24
|
+
HumanEval) for the leaderboard, a judge report (win rates, position / length / self-preference bias, agreement
|
|
25
|
+
with humans), rubric reports, an end-to-end RAG report that blames each failure on retrieval or generation, a
|
|
26
|
+
single-file HTML report; sample-size and power planning, cluster-bootstrap intervals (`clusters=`), a fairness
|
|
27
|
+
report (gaps with intervals, intersectional groups) and survival metrics (C-index, time-dependent AUC,
|
|
28
|
+
integrated Brier score); a GitHub Action that comments results on pull requests.
|
|
18
29
|
- **1.1.2** — a once-a-day notice when a newer release exists, and a one-command upgrade (`evalsuite upgrade`
|
|
19
30
|
or `es.upgrade()`); every README refreshed with current benchmark numbers.
|
|
20
31
|
- **1.1.1** — hardening: every engine metric fuzzed (no crashes on malformed input), NaN / Infinity preserved in
|
|
@@ -349,6 +360,101 @@ ei.log_mlflow(result)
|
|
|
349
360
|
ei.log_wandb(result)
|
|
350
361
|
```
|
|
351
362
|
|
|
363
|
+
## Planning a test set
|
|
364
|
+
|
|
365
|
+
```python
|
|
366
|
+
es.sample_size_two_proportions(0.80, 0.83, discordance=0.10) # items to detect +3 points between two models
|
|
367
|
+
es.sample_size_proportion(0.9, 0.02) # items for accuracy ± 2 points
|
|
368
|
+
es.sample_size_auc(0.85, prevalence=0.2, half_width=0.03) # positives and negatives for an AUC interval
|
|
369
|
+
es.power_two_proportions(500, 0.80, 0.83, discordance=0.10) # power with the items you have
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Clustered data
|
|
373
|
+
|
|
374
|
+
Several scans per patient, several questions per document or several sites make ordinary intervals too narrow.
|
|
375
|
+
Pass the cluster of each row and every interval and baseline test resamples whole clusters:
|
|
376
|
+
|
|
377
|
+
```python
|
|
378
|
+
patient = np.repeat(np.arange(40), 5) # 200 rows, 5 per patient
|
|
379
|
+
result = es.evaluate(y_true, y_pred, clusters=patient)
|
|
380
|
+
es.bootstrap_ci("roc_auc", y_true, y_prob=y_prob, clusters=patient)
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## Fairness
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
group = np.where(np.arange(200) % 3 == 0, "A", "B")
|
|
387
|
+
report = es.fairness_report(y_true, y_pred, y_prob, groups={"group": group})
|
|
388
|
+
print(report.summary()) # per-group rates with CIs, parity / equalized-odds gaps with CIs, Holm-adjusted tests
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Several attributes give intersectional groups (`groups={"sex": sex, "age": age}`); gap definitions match
|
|
392
|
+
Fairlearn's.
|
|
393
|
+
|
|
394
|
+
## Survival analysis
|
|
395
|
+
|
|
396
|
+
```python
|
|
397
|
+
time = np.arange(1, 201) * 0.5
|
|
398
|
+
event = np.arange(200) % 4 != 0
|
|
399
|
+
risk = -time + np.sin(np.arange(200))
|
|
400
|
+
es.concordance_index(time, event, risk) # Harrell's C (ipcw=True: Uno's C)
|
|
401
|
+
es.time_dependent_auc(time, event, risk, [20, 40, 60]) # cumulative/dynamic AUC
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
`brier_score_survival` and `integrated_brier_score` take predicted survival probabilities. All agree with
|
|
405
|
+
scikit-survival to 1e-15 (Harrell's C is about 17× faster).
|
|
406
|
+
|
|
407
|
+
## LLM judges, rubrics and RAG
|
|
408
|
+
|
|
409
|
+
```python
|
|
410
|
+
judgements = [
|
|
411
|
+
{"model_a": "m1", "model_b": "m2", "verdict": "A", "verdict_swapped": "A", "length_a": 120, "length_b": 80},
|
|
412
|
+
{"model_a": "m2", "model_b": "m1", "verdict": "B", "verdict_swapped": "tie", "length_a": 60, "length_b": 150},
|
|
413
|
+
{"model_a": "m1", "model_b": "m2", "verdict": "tie", "verdict_swapped": "tie", "length_a": 90, "length_b": 95},
|
|
414
|
+
]
|
|
415
|
+
print(es.judge_report(judgements, n_resamples=200).summary())
|
|
416
|
+
# win rates, Bradley–Terry, position consistency, length bias, self-preference, agreement with humans
|
|
417
|
+
|
|
418
|
+
rag = es.rag_report(
|
|
419
|
+
[
|
|
420
|
+
{"retrieved": ["d1", "d7"], "relevant": ["d1"], "answer": "Paris", "reference": "Paris"},
|
|
421
|
+
{"retrieved": ["d3"], "relevant": ["d2"], "answer": "Rome", "reference": "Oslo"},
|
|
422
|
+
]
|
|
423
|
+
)
|
|
424
|
+
print(rag.summary()) # retrieval / grounding / answer metrics, and each failure blamed on a stage
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Leaderboards know common benchmarks: `es.leaderboard(runs, benchmark="gsm8k", references=es.load_benchmark("gsm8k"))`
|
|
428
|
+
(also `mmlu`, `arc`, `truthfulqa`, `humaneval`; datasets via `pip install "evalsuite-python[benchmarks]"`).
|
|
429
|
+
|
|
430
|
+
## One HTML report
|
|
431
|
+
|
|
432
|
+
```python
|
|
433
|
+
page = es.html_report(
|
|
434
|
+
{"Test set": es.evaluate(y_true, y_pred, y_prob=y_prob), "Notes": "Model v3."},
|
|
435
|
+
title="Model evaluation",
|
|
436
|
+
path="report.html",
|
|
437
|
+
)
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Any EvalSuite result, Matplotlib figure or Markdown text becomes a section of one self-contained file (no
|
|
441
|
+
scripts, no external requests).
|
|
442
|
+
|
|
443
|
+
## Evaluation in pull requests
|
|
444
|
+
|
|
445
|
+
```yaml
|
|
446
|
+
- uses: mkcs28/evalsuite-python@v1.2.1
|
|
447
|
+
with:
|
|
448
|
+
predictions: predictions.csv
|
|
449
|
+
y-true: label
|
|
450
|
+
y-pred: pred
|
|
451
|
+
baseline-pred: base_pred # e.g. the main branch's predictions
|
|
452
|
+
fail-on-regression: "true"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
The action comments metrics with intervals and paired tests on the pull request and fails it on a significant
|
|
456
|
+
regression ([full example](examples/evalsuite-action.yml)).
|
|
457
|
+
|
|
352
458
|
## Classification report
|
|
353
459
|
|
|
354
460
|
```python
|
|
@@ -445,11 +551,11 @@ metric calls. At 1,000,000 samples (pixels for segmentation; 1,000 images for de
|
|
|
445
551
|
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 219.5 | 889.0 | **4.05×** |
|
|
446
552
|
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 266.7 | 2399.8 | **9.00×** |
|
|
447
553
|
|
|
448
|
-
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`,
|
|
449
|
-
|
|
450
|
-
independent textbook formula and
|
|
451
|
-
comparisons agree**, and against the libraries the geometric-mean
|
|
452
|
-
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
554
|
+
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`, re-run on 1.2.0): all 225 registered
|
|
555
|
+
metrics and statistics functions at 10,000 and 100,000 samples. 82 are compared with a reference library, 118
|
|
556
|
+
with an independent textbook formula and 25 (learned, judge-dependent, randomised, or whose reference library was
|
|
557
|
+
not installed) are timed alone; **all 200 comparisons agree**, and against the libraries the geometric-mean
|
|
558
|
+
speed-up is **5.50×** (164 of 164 measurements faster). Per-metric table in BENCHMARKS.md.
|
|
453
559
|
|
|
454
560
|
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
455
561
|
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
@@ -47,6 +47,7 @@ keras = ["keras>=3"]
|
|
|
47
47
|
lightning = ["lightning>=2"]
|
|
48
48
|
mlflow = ["mlflow>=2"]
|
|
49
49
|
docx = ["python-docx>=1.0"]
|
|
50
|
+
benchmarks = ["datasets>=2.14"]
|
|
50
51
|
wandb = ["wandb>=0.16"]
|
|
51
52
|
all = ["matplotlib>=3.5", "pillow>=9", "nltk>=3.8"]
|
|
52
53
|
dev = [
|
|
@@ -55,6 +56,8 @@ dev = [
|
|
|
55
56
|
"hypothesis>=6.80",
|
|
56
57
|
"scikit-learn>=1.4",
|
|
57
58
|
"statsmodels>=0.13",
|
|
59
|
+
"scikit-survival>=0.22; python_version >= '3.10'",
|
|
60
|
+
"fairlearn>=0.10",
|
|
58
61
|
"matplotlib>=3.5",
|
|
59
62
|
"pillow>=9",
|
|
60
63
|
"pycocotools>=2.0.7",
|
|
@@ -130,6 +133,8 @@ ignore = ["N803", "N806", "RUF022", "UP007", "UP045", "RUF001", "RUF002", "RUF00
|
|
|
130
133
|
# Developer script recording parity fixtures for the Rust crate: each case's lambda runs immediately.
|
|
131
134
|
"scripts/rust_fixtures.py" = ["B007", "B023", "E501", "E731", "E741", "RUF005"]
|
|
132
135
|
"scripts/make_notebooks.py" = ["E501", "S102"]
|
|
136
|
+
# The type-checking-only re-exports in the package root are served lazily by __getattr__.
|
|
137
|
+
"src/evalsuite/__init__.py" = ["F401", "F403", "F405", "F822"]
|
|
133
138
|
"notebooks/*.ipynb" = ["E501", "I001", "S311"]
|
|
134
139
|
|
|
135
140
|
[tool.mypy]
|
|
@@ -319,7 +319,7 @@ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
|
319
319
|
|
|
320
320
|
[[package]]
|
|
321
321
|
name = "evalsuite"
|
|
322
|
-
version = "1.1
|
|
322
|
+
version = "1.2.1"
|
|
323
323
|
dependencies = [
|
|
324
324
|
"criterion",
|
|
325
325
|
"evalsuite-core",
|
|
@@ -334,14 +334,14 @@ dependencies = [
|
|
|
334
334
|
|
|
335
335
|
[[package]]
|
|
336
336
|
name = "evalsuite-capi"
|
|
337
|
-
version = "1.1
|
|
337
|
+
version = "1.2.1"
|
|
338
338
|
dependencies = [
|
|
339
339
|
"evalsuite",
|
|
340
340
|
]
|
|
341
341
|
|
|
342
342
|
[[package]]
|
|
343
343
|
name = "evalsuite-cli"
|
|
344
|
-
version = "1.1
|
|
344
|
+
version = "1.2.1"
|
|
345
345
|
dependencies = [
|
|
346
346
|
"clap",
|
|
347
347
|
"csv",
|
|
@@ -351,14 +351,14 @@ dependencies = [
|
|
|
351
351
|
|
|
352
352
|
[[package]]
|
|
353
353
|
name = "evalsuite-core"
|
|
354
|
-
version = "1.1
|
|
354
|
+
version = "1.2.1"
|
|
355
355
|
dependencies = [
|
|
356
356
|
"rayon",
|
|
357
357
|
]
|
|
358
358
|
|
|
359
359
|
[[package]]
|
|
360
360
|
name = "evalsuite-py"
|
|
361
|
-
version = "1.1
|
|
361
|
+
version = "1.2.1"
|
|
362
362
|
dependencies = [
|
|
363
363
|
"evalsuite-core",
|
|
364
364
|
"pyo3",
|
|
@@ -367,7 +367,7 @@ dependencies = [
|
|
|
367
367
|
|
|
368
368
|
[[package]]
|
|
369
369
|
name = "evalsuite-wasm"
|
|
370
|
-
version = "1.1
|
|
370
|
+
version = "1.2.1"
|
|
371
371
|
dependencies = [
|
|
372
372
|
"evalsuite",
|
|
373
373
|
"js-sys",
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//! Survival analysis: Harrell's concordance index in O(n log n) with a Fenwick tree.
|
|
2
|
+
|
|
3
|
+
/// `(Σ w_i (concordant_i + ties_i / 2), Σ w_i comparable_i, comparable pairs)` over events `i`, where `j` is
|
|
4
|
+
/// comparable to event `i` when `t_j > t_i`, or `t_j == t_i` with `j` censored; risks within `tol` are ties.
|
|
5
|
+
/// Subjects are processed in decreasing time (stable), censored subjects at a time before its events, exactly
|
|
6
|
+
/// as EvalSuite's Python implementation, so the sums are accumulated in the same order and bit-identical.
|
|
7
|
+
pub fn concordance(t: &[f64], event: &[u8], risk: &[f64], w: &[f64], tol: f64) -> (f64, f64, u64) {
|
|
8
|
+
let n = t.len();
|
|
9
|
+
let mut order_r: Vec<f64> = risk.to_vec();
|
|
10
|
+
order_r.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal));
|
|
11
|
+
let below = |x: f64| order_r.partition_point(|&v| v < x);
|
|
12
|
+
let at_most = |x: f64| order_r.partition_point(|&v| v <= x);
|
|
13
|
+
let slot: Vec<usize> = risk.iter().map(|&r| below(r)).collect();
|
|
14
|
+
let mut order_t: Vec<usize> = (0..n).collect();
|
|
15
|
+
order_t.sort_by(|&a, &b| {
|
|
16
|
+
(-t[a])
|
|
17
|
+
.partial_cmp(&-t[b])
|
|
18
|
+
.unwrap_or(std::cmp::Ordering::Equal)
|
|
19
|
+
}); // stable, as NumPy's
|
|
20
|
+
let mut tree = vec![0u64; n + 1];
|
|
21
|
+
let add = |tree: &mut Vec<u64>, pos: usize| {
|
|
22
|
+
let mut i = pos + 1;
|
|
23
|
+
while i <= n {
|
|
24
|
+
tree[i] += 1;
|
|
25
|
+
i += i & i.wrapping_neg();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
let prefix = |tree: &Vec<u64>, pos: usize| {
|
|
29
|
+
let mut i = pos;
|
|
30
|
+
let mut s = 0u64;
|
|
31
|
+
while i > 0 {
|
|
32
|
+
s += tree[i];
|
|
33
|
+
i -= i & i.wrapping_neg();
|
|
34
|
+
}
|
|
35
|
+
s
|
|
36
|
+
};
|
|
37
|
+
let (mut num, mut den, mut pairs, mut inserted) = (0.0f64, 0.0f64, 0u64, 0u64);
|
|
38
|
+
let mut i = 0;
|
|
39
|
+
while i < n {
|
|
40
|
+
let ti = t[order_t[i]];
|
|
41
|
+
let mut j = i;
|
|
42
|
+
while j < n && t[order_t[j]] == ti {
|
|
43
|
+
j += 1;
|
|
44
|
+
}
|
|
45
|
+
let group = &order_t[i..j];
|
|
46
|
+
for &k in group.iter().filter(|&&k| event[k] == 0) {
|
|
47
|
+
add(&mut tree, slot[k]);
|
|
48
|
+
inserted += 1;
|
|
49
|
+
}
|
|
50
|
+
for &k in group.iter().filter(|&&k| event[k] != 0) {
|
|
51
|
+
let less = prefix(&tree, below(risk[k] - tol));
|
|
52
|
+
let ties = prefix(&tree, at_most(risk[k] + tol)) - less;
|
|
53
|
+
if inserted > 0 {
|
|
54
|
+
num += w[k] * (less as f64 + 0.5 * ties as f64);
|
|
55
|
+
den += w[k] * inserted as f64;
|
|
56
|
+
pairs += inserted;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for &k in group.iter().filter(|&&k| event[k] != 0) {
|
|
60
|
+
add(&mut tree, slot[k]);
|
|
61
|
+
inserted += 1;
|
|
62
|
+
}
|
|
63
|
+
i = j;
|
|
64
|
+
}
|
|
65
|
+
(num, den, pairs)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#[cfg(test)]
|
|
69
|
+
mod tests {
|
|
70
|
+
use super::*;
|
|
71
|
+
|
|
72
|
+
#[test]
|
|
73
|
+
fn small_example() {
|
|
74
|
+
// times 1..4, all events, risk decreasing with time: every comparable pair concordant
|
|
75
|
+
let (num, den, pairs) = concordance(
|
|
76
|
+
&[1.0, 2.0, 3.0, 4.0],
|
|
77
|
+
&[1, 1, 1, 1],
|
|
78
|
+
&[4.0, 3.0, 2.0, 1.0],
|
|
79
|
+
&[1.0; 4],
|
|
80
|
+
1e-8,
|
|
81
|
+
);
|
|
82
|
+
assert_eq!((num, den, pairs), (6.0, 6.0, 6));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
//! are bit-identical for any number of threads.
|
|
11
11
|
|
|
12
12
|
use evalsuite_core::{
|
|
13
|
-
agreement, coco, curve, groups, meteor, permutation, qa, ranks, resample, surface,
|
|
13
|
+
agreement, coco, curve, groups, meteor, permutation, qa, ranks, resample, surface, survival,
|
|
14
|
+
ter, text,
|
|
14
15
|
};
|
|
15
16
|
use pyo3::exceptions::PyValueError;
|
|
16
17
|
use pyo3::prelude::*;
|
|
@@ -395,6 +396,69 @@ fn coco_evaluate<'py>(
|
|
|
395
396
|
))
|
|
396
397
|
}
|
|
397
398
|
|
|
399
|
+
/// Harrell's concordance sums `(numerator, denominator, comparable pairs)`. `time`, `risk` and `weight` are float64
|
|
400
|
+
/// views and `event` a uint8 view, all of `n` elements, kept alive and unchanged by the caller during the call.
|
|
401
|
+
#[pyfunction]
|
|
402
|
+
fn concordance(
|
|
403
|
+
py: Python<'_>,
|
|
404
|
+
time: (usize, usize),
|
|
405
|
+
event: (usize, usize),
|
|
406
|
+
risk: (usize, usize),
|
|
407
|
+
weight: (usize, usize),
|
|
408
|
+
tol: f64,
|
|
409
|
+
) -> PyResult<(f64, f64, u64)> {
|
|
410
|
+
let t: &[f64] = view(time.0, time.1)?;
|
|
411
|
+
let e: &[u8] = view(event.0, event.1)?;
|
|
412
|
+
let r: &[f64] = view(risk.0, risk.1)?;
|
|
413
|
+
let w: &[f64] = view(weight.0, weight.1)?;
|
|
414
|
+
if e.len() != t.len() || r.len() != t.len() || w.len() != t.len() {
|
|
415
|
+
return Err(PyValueError::new_err(
|
|
416
|
+
"time, event, risk and weight must have the same length",
|
|
417
|
+
));
|
|
418
|
+
}
|
|
419
|
+
Ok(py.detach(|| survival::concordance(t, e, r, w, tol)))
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
#[allow(clippy::too_many_arguments)]
|
|
423
|
+
/// [`concordance`] on every row of `indices` (an int64 view of `rows × n` subject indices), resamples in
|
|
424
|
+
/// parallel. Each row gathers time, event, risk and weight at its indices, exactly as NumPy fancy indexing.
|
|
425
|
+
#[pyfunction]
|
|
426
|
+
fn concordance_resamples(
|
|
427
|
+
py: Python<'_>,
|
|
428
|
+
time: (usize, usize),
|
|
429
|
+
event: (usize, usize),
|
|
430
|
+
risk: (usize, usize),
|
|
431
|
+
weight: (usize, usize),
|
|
432
|
+
tol: f64,
|
|
433
|
+
indices: (usize, usize),
|
|
434
|
+
rows: usize,
|
|
435
|
+
) -> PyResult<Vec<(f64, f64, u64)>> {
|
|
436
|
+
let t: &[f64] = view(time.0, time.1)?;
|
|
437
|
+
let e: &[u8] = view(event.0, event.1)?;
|
|
438
|
+
let r: &[f64] = view(risk.0, risk.1)?;
|
|
439
|
+
let w: &[f64] = view(weight.0, weight.1)?;
|
|
440
|
+
let idx: &[i64] = view(indices.0, indices.1)?;
|
|
441
|
+
let n = t.len();
|
|
442
|
+
if e.len() != n || r.len() != n || w.len() != n || rows == 0 || idx.len() % rows != 0 {
|
|
443
|
+
return Err(PyValueError::new_err("inconsistent lengths"));
|
|
444
|
+
}
|
|
445
|
+
if idx.iter().any(|&i| i < 0 || i as usize >= n) {
|
|
446
|
+
return Err(PyValueError::new_err("index out of range"));
|
|
447
|
+
}
|
|
448
|
+
let m = idx.len() / rows;
|
|
449
|
+
Ok(py.detach(|| {
|
|
450
|
+
idx.par_chunks(m)
|
|
451
|
+
.map(|row| {
|
|
452
|
+
let tt: Vec<f64> = row.iter().map(|&i| t[i as usize]).collect();
|
|
453
|
+
let ee: Vec<u8> = row.iter().map(|&i| e[i as usize]).collect();
|
|
454
|
+
let rr: Vec<f64> = row.iter().map(|&i| r[i as usize]).collect();
|
|
455
|
+
let ww: Vec<f64> = row.iter().map(|&i| w[i as usize]).collect();
|
|
456
|
+
survival::concordance(&tt, &ee, &rr, &ww, tol)
|
|
457
|
+
})
|
|
458
|
+
.collect()
|
|
459
|
+
}))
|
|
460
|
+
}
|
|
461
|
+
|
|
398
462
|
/// Counts of each code `0..k` in every resample. `codes` is a uint32 view, `indices` an int64 view of
|
|
399
463
|
/// `rows × n` indices. Returns uint64 bytes (`rows × k`).
|
|
400
464
|
#[pyfunction]
|
|
@@ -1066,6 +1130,8 @@ fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
|
1066
1130
|
}
|
|
1067
1131
|
}
|
|
1068
1132
|
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
|
|
1133
|
+
m.add_function(wrap_pyfunction!(concordance, m)?)?;
|
|
1134
|
+
m.add_function(wrap_pyfunction!(concordance_resamples, m)?)?;
|
|
1069
1135
|
m.add_function(wrap_pyfunction!(bleu_stats, m)?)?;
|
|
1070
1136
|
m.add_function(wrap_pyfunction!(self_bleu_stats, m)?)?;
|
|
1071
1137
|
m.add_function(wrap_pyfunction!(ter_corpus, m)?)?;
|