evalsuite-python 1.3.0__tar.gz → 1.3.5__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.3.0 → evalsuite_python-1.3.5}/CHANGELOG.md +25 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/PKG-INFO +7 -3
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/README.md +6 -2
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/Cargo.lock +6 -6
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/Cargo.toml +1 -1
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/agreement.py +14 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/bayes.py +6 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/forecasting.py +10 -1
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/judging.py +15 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/multilabel.py +28 -5
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/rag_report.py +6 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/recalibration.py +21 -6
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/compare.py +19 -18
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/intervals.py +35 -2
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/paired.py +4 -5
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/version.py +1 -1
- evalsuite_python-1.3.5/tests/test_v135.py +74 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v13_edges.py +1 -1
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/CONTRIBUTING.md +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/LICENSE +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/LICENSE-APACHE +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/pyproject.toml +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/Cargo.toml +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/README.md +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/agreement.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/coco.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/curve.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/groups.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/hash.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/lib.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/meteor.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/permutation.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/qa.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/ranks.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/resample.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/surface.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/survival.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/ter.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-core/src/text.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-py/Cargo.toml +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/rust/evalsuite-py/src/lib.rs +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/__main__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/_bench_metrics.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/_evalci.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/_lazy.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/_native.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/_update.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/api.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/benchmarks.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/calibration.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/cards.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/classification/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/classification/_common.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/classification/metrics.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/cli/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/cli/main.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/clinical/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/clinical/metrics.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/clinical/report.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/context.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/exceptions.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/export.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/registry.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/result.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/types.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/core/validation.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/drift.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/fairness.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/harness.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/html_report.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/integrations.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llm_benchmarks.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/_common.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/agents.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/code.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/efficiency.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/longcontext.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/multilingual.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/robustness.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/safety.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/llmsys/uncertainty.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/monitor.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/plot.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/py.typed +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/regression/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/regression/metrics.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/reporting.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/_resolve.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/effect.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/hypothesis.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/planning.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/stats/results.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/survival.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/_common.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/factuality.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/generation.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/judge.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/qa.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/rag.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/reasoning.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/report.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/retrieval.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/semantic.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/spice.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/text/structured.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/vision/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/vision/detection.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/src/evalsuite/vision/segmentation.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/classification/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/classification/test_against_sklearn.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/clinical/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/clinical/test_outputs.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/clinical/test_v020.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/conftest.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/integration/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/integration/test_qa.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/integration/test_readme_examples.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/integration/test_repo_hygiene.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_code_longcontext_efficiency.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_edges.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_fast_text.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_hardening.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_safety_robustness.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/llmsys/test_uncertainty_agents_multilingual.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/output/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/output/test_benchmarks.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/output/test_cli.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/output/test_plot.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/output/test_reporting.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/regression/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/regression/test_against_sklearn.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/stats/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/stats/test_branches.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/stats/test_compare.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/stats/test_fast_paths.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/stats/test_reference.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_cards.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_harness.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_integrations.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_monitor.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_native.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_update.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v111_fixes.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v12.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v121.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v121_coverage.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/test_v13.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/text/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/text/test_against_references.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/text/test_text_edges.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/text/test_v040.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/unit/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/unit/test_core.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/unit/test_edges.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/vision/__init__.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/vision/test_detection.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/vision/test_edges.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/vision/test_outputs.py +0 -0
- {evalsuite_python-1.3.0 → evalsuite_python-1.3.5}/tests/vision/test_segmentation.py +0 -0
|
@@ -6,6 +6,31 @@ All notable changes to this project are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.3.5] - 2026-11-28
|
|
10
|
+
|
|
11
|
+
A deep clean of the 1.3 modules and bounded-memory resampling. Results are unchanged except where a bug is
|
|
12
|
+
fixed below.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- `ranking_report` counted a document listed more than once in a run once per listing (AP and recall could
|
|
17
|
+
exceed 1); a document now counts once, at its best rank. NaN document scores are rejected.
|
|
18
|
+
- `recalibrate(..., method="temperature")` with string labels mapped labels to columns by the labels present in
|
|
19
|
+
`y_true`, which is wrong when a class is missing; it now requires `classes=` (the label of each column) when
|
|
20
|
+
the labels and columns do not line up, and rejects unknown labels.
|
|
21
|
+
- `multilabel_report` no longer reports undefined metrics (e.g. ROC AUC when no label is positive) as NaN rows;
|
|
22
|
+
they are listed in `settings["undefined"]` and in the summary.
|
|
23
|
+
- `diebold_mariano` gives a clear error when the loss differential overflows instead of a NumPy warning;
|
|
24
|
+
`icc` explains when subjects do not differ in their mean rating.
|
|
25
|
+
- Every report (`JudgeReport`, `RubricReport`, `RAGReport`, `ICCResult`, `BlandAltman`, `BayesComparison`,
|
|
26
|
+
`ForecastReport`, `MultilabelReport`, `RankingReport`) now has `to_html`; `RubricReport` gains `to_json`.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- Bootstrap resamples in `bootstrap_ci`, `compare` and `paired_bootstrap_test` are drawn in chunks: peak memory
|
|
31
|
+
on 100,000 observations falls from about 1.6 GB to about 90 MB (and the interval is about 30% faster), with
|
|
32
|
+
bit-identical results.
|
|
33
|
+
|
|
9
34
|
## [1.3.0] - 2026-11-28
|
|
10
35
|
|
|
11
36
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: Intended Audience :: Healthcare Industry
|
|
@@ -104,11 +104,15 @@ evaluation into one consistent, validated, documented framework.
|
|
|
104
104
|
> **On an older version? Upgrade once:** `pip install -U evalsuite-python`. From 1.1.2 on, EvalSuite tells you
|
|
105
105
|
> when a newer release is out (`evalsuite upgrade`).
|
|
106
106
|
|
|
107
|
-
> **Status: stable (1.3.
|
|
107
|
+
> **Status: stable (1.3.5).** [Example notebooks](notebooks/README.md) (Colab) ·
|
|
108
108
|
> [in-browser tools](https://evalsuite-nine.vercel.app/tools) · [changelog](CHANGELOG.md)
|
|
109
109
|
|
|
110
110
|
**What's new**
|
|
111
111
|
|
|
112
|
+
- **1.3.5** — a deep clean of the 1.3 modules (ranking counts a document once and rejects NaN scores, temperature
|
|
113
|
+
scaling maps string labels to the right columns, clearer errors on degenerate data, `to_html` on every report)
|
|
114
|
+
and bounded memory: bootstrap intervals on 100,000 rows peak at about 90 MB instead of 1.6 GB, with identical
|
|
115
|
+
results.
|
|
112
116
|
- **1.3** — a calibration suite (Platt, isotonic, temperature, beta and histogram recalibration; bootstrap
|
|
113
117
|
intervals in `calibration_report`), multi-label and ranking reports (trec_eval-exact nDCG, AP, MRR with
|
|
114
118
|
intervals and randomization tests), forecasting (MASE, RMSSE, pinball loss, interval score, CRPS,
|
|
@@ -610,7 +614,7 @@ scripts, no external requests).
|
|
|
610
614
|
## Evaluation in pull requests
|
|
611
615
|
|
|
612
616
|
```yaml
|
|
613
|
-
- uses: mkcs28/evalsuite-python@v1.3.
|
|
617
|
+
- uses: mkcs28/evalsuite-python@v1.3.5
|
|
614
618
|
with:
|
|
615
619
|
predictions: predictions.csv
|
|
616
620
|
y-true: label
|
|
@@ -13,11 +13,15 @@ evaluation into one consistent, validated, documented framework.
|
|
|
13
13
|
> **On an older version? Upgrade once:** `pip install -U evalsuite-python`. From 1.1.2 on, EvalSuite tells you
|
|
14
14
|
> when a newer release is out (`evalsuite upgrade`).
|
|
15
15
|
|
|
16
|
-
> **Status: stable (1.3.
|
|
16
|
+
> **Status: stable (1.3.5).** [Example notebooks](notebooks/README.md) (Colab) ·
|
|
17
17
|
> [in-browser tools](https://evalsuite-nine.vercel.app/tools) · [changelog](CHANGELOG.md)
|
|
18
18
|
|
|
19
19
|
**What's new**
|
|
20
20
|
|
|
21
|
+
- **1.3.5** — a deep clean of the 1.3 modules (ranking counts a document once and rejects NaN scores, temperature
|
|
22
|
+
scaling maps string labels to the right columns, clearer errors on degenerate data, `to_html` on every report)
|
|
23
|
+
and bounded memory: bootstrap intervals on 100,000 rows peak at about 90 MB instead of 1.6 GB, with identical
|
|
24
|
+
results.
|
|
21
25
|
- **1.3** — a calibration suite (Platt, isotonic, temperature, beta and histogram recalibration; bootstrap
|
|
22
26
|
intervals in `calibration_report`), multi-label and ranking reports (trec_eval-exact nDCG, AP, MRR with
|
|
23
27
|
intervals and randomization tests), forecasting (MASE, RMSSE, pinball loss, interval score, CRPS,
|
|
@@ -519,7 +523,7 @@ scripts, no external requests).
|
|
|
519
523
|
## Evaluation in pull requests
|
|
520
524
|
|
|
521
525
|
```yaml
|
|
522
|
-
- uses: mkcs28/evalsuite-python@v1.3.
|
|
526
|
+
- uses: mkcs28/evalsuite-python@v1.3.5
|
|
523
527
|
with:
|
|
524
528
|
predictions: predictions.csv
|
|
525
529
|
y-true: label
|
|
@@ -319,7 +319,7 @@ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
|
319
319
|
|
|
320
320
|
[[package]]
|
|
321
321
|
name = "evalsuite"
|
|
322
|
-
version = "1.3.
|
|
322
|
+
version = "1.3.5"
|
|
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.3.
|
|
337
|
+
version = "1.3.5"
|
|
338
338
|
dependencies = [
|
|
339
339
|
"evalsuite",
|
|
340
340
|
]
|
|
341
341
|
|
|
342
342
|
[[package]]
|
|
343
343
|
name = "evalsuite-cli"
|
|
344
|
-
version = "1.3.
|
|
344
|
+
version = "1.3.5"
|
|
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.3.
|
|
354
|
+
version = "1.3.5"
|
|
355
355
|
dependencies = [
|
|
356
356
|
"rayon",
|
|
357
357
|
]
|
|
358
358
|
|
|
359
359
|
[[package]]
|
|
360
360
|
name = "evalsuite-py"
|
|
361
|
-
version = "1.3.
|
|
361
|
+
version = "1.3.5"
|
|
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.3.
|
|
370
|
+
version = "1.3.5"
|
|
371
371
|
dependencies = [
|
|
372
372
|
"evalsuite",
|
|
373
373
|
"js-sys",
|
|
@@ -106,6 +106,12 @@ class ICCResult:
|
|
|
106
106
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
107
107
|
return json.dumps(self.to_dict(), indent=indent)
|
|
108
108
|
|
|
109
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
110
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
111
|
+
from .html_report import _markdown_tables
|
|
112
|
+
|
|
113
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
114
|
+
|
|
109
115
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
110
116
|
d = digits
|
|
111
117
|
rows = ["| Form | ICC | CI | F | p | Meaning |", "| --- | ---: | --- | ---: | ---: | --- |"]
|
|
@@ -186,6 +192,8 @@ def icc(
|
|
|
186
192
|
msw = (ss_c + ss_e) / (n * (k - 1))
|
|
187
193
|
if msr == 0 and mse == 0 and msw == 0:
|
|
188
194
|
raise InputValidationError("All ratings are identical; the ICC is undefined.")
|
|
195
|
+
if msr == 0:
|
|
196
|
+
raise InputValidationError("Subjects do not differ in their mean rating; the ICC is undefined.")
|
|
189
197
|
a = (1 - lv) / 2
|
|
190
198
|
df1, df2_1, df2_3 = n - 1, n * (k - 1), (n - 1) * (k - 1)
|
|
191
199
|
|
|
@@ -288,6 +296,12 @@ class BlandAltman:
|
|
|
288
296
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
289
297
|
return json.dumps(self.to_dict(), indent=indent)
|
|
290
298
|
|
|
299
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
300
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
301
|
+
from .html_report import _markdown_tables
|
|
302
|
+
|
|
303
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
304
|
+
|
|
291
305
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
292
306
|
d = digits
|
|
293
307
|
rows = ["| Quantity | Estimate | CI |", "| --- | ---: | --- |"]
|
|
@@ -91,6 +91,12 @@ class BayesComparison:
|
|
|
91
91
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
92
92
|
return json.dumps(self.to_dict(), indent=indent)
|
|
93
93
|
|
|
94
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
95
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
96
|
+
from .html_report import _markdown_tables
|
|
97
|
+
|
|
98
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
99
|
+
|
|
94
100
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
95
101
|
d = digits
|
|
96
102
|
rows = ["| Quantity | Value |", "| --- | ---: |"]
|
|
@@ -229,11 +229,14 @@ def diebold_mariano(
|
|
|
229
229
|
if h < 1:
|
|
230
230
|
raise InputValidationError("h must be at least 1.")
|
|
231
231
|
if loss == "squared":
|
|
232
|
-
|
|
232
|
+
with np.errstate(over="ignore", invalid="ignore"):
|
|
233
|
+
d = (y - a) ** 2 - (y - b) ** 2
|
|
233
234
|
elif loss == "absolute":
|
|
234
235
|
d = np.abs(y - a) - np.abs(y - b)
|
|
235
236
|
else:
|
|
236
237
|
raise InputValidationError("loss must be 'squared' or 'absolute'.")
|
|
238
|
+
if not np.all(np.isfinite(d)):
|
|
239
|
+
raise InputValidationError("The loss differential overflows; rescale the series before testing.")
|
|
237
240
|
n = d.size
|
|
238
241
|
if n < 3 or h >= n:
|
|
239
242
|
raise InputValidationError("The Diebold–Mariano test needs more observations than the horizon (and ≥ 3).")
|
|
@@ -316,6 +319,12 @@ class ForecastReport:
|
|
|
316
319
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
317
320
|
return json.dumps(self.to_dict(), indent=indent)
|
|
318
321
|
|
|
322
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
323
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
324
|
+
from .html_report import _markdown_tables
|
|
325
|
+
|
|
326
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
327
|
+
|
|
319
328
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
320
329
|
d = digits
|
|
321
330
|
has_mase = any("mase" in r for r in self.rows)
|
|
@@ -151,6 +151,12 @@ class JudgeReport:
|
|
|
151
151
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
152
152
|
return json.dumps(self.to_dict(), indent=indent, allow_nan=False)
|
|
153
153
|
|
|
154
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
155
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
156
|
+
from .html_report import _markdown_tables
|
|
157
|
+
|
|
158
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
159
|
+
|
|
154
160
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
155
161
|
d = digits
|
|
156
162
|
pct = f"{self.settings['level'] * 100:g}%"
|
|
@@ -430,6 +436,15 @@ class RubricReport:
|
|
|
430
436
|
def __repr__(self) -> str:
|
|
431
437
|
return self.summary()
|
|
432
438
|
|
|
439
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
440
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
441
|
+
from .html_report import _markdown_tables
|
|
442
|
+
|
|
443
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
444
|
+
|
|
445
|
+
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
446
|
+
return json.dumps(self.to_dict(), indent=indent)
|
|
447
|
+
|
|
433
448
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
434
449
|
d = digits
|
|
435
450
|
rows = ["| Model | Criterion | Mean (CI) | n |", "| --- | --- | --- | ---: |"]
|
|
@@ -165,6 +165,8 @@ class MultilabelReport:
|
|
|
165
165
|
]
|
|
166
166
|
for k, m in self.metrics.items():
|
|
167
167
|
lines.append(f" {k:<34} {m['value']:.{d}f} ({m['low']:.{d}f}–{m['high']:.{d}f})")
|
|
168
|
+
if s.get("undefined"):
|
|
169
|
+
lines.append(f" Undefined on these data (left out): {', '.join(s['undefined'])}")
|
|
168
170
|
return "\n".join(lines)
|
|
169
171
|
|
|
170
172
|
def __repr__(self) -> str:
|
|
@@ -181,6 +183,12 @@ class MultilabelReport:
|
|
|
181
183
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
182
184
|
return json.dumps(self.to_dict(), indent=indent)
|
|
183
185
|
|
|
186
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
187
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
188
|
+
from .html_report import _markdown_tables
|
|
189
|
+
|
|
190
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
191
|
+
|
|
184
192
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
185
193
|
d = digits
|
|
186
194
|
rows = ["| Metric | Value | CI |", "| --- | ---: | --- |"]
|
|
@@ -253,7 +261,12 @@ def multilabel_report(
|
|
|
253
261
|
draws[k].append(v)
|
|
254
262
|
done += chunk
|
|
255
263
|
boot = {k: np.concatenate(v) for k, v in draws.items()}
|
|
256
|
-
|
|
264
|
+
undefined = [k for k, v in point.items() if not math.isfinite(v)]
|
|
265
|
+
metrics = {
|
|
266
|
+
k: {"value": v, **dict(zip(("low", "high"), _ci(boot[k], level)))}
|
|
267
|
+
for k, v in point.items()
|
|
268
|
+
if k not in undefined
|
|
269
|
+
}
|
|
257
270
|
tp = (Y & P).sum(axis=0).astype(float)
|
|
258
271
|
fp = (~Y & P).sum(axis=0).astype(float)
|
|
259
272
|
fn = (Y & ~P).sum(axis=0).astype(float)
|
|
@@ -268,7 +281,8 @@ def multilabel_report(
|
|
|
268
281
|
}
|
|
269
282
|
for j in range(L)
|
|
270
283
|
)
|
|
271
|
-
|
|
284
|
+
settings = {"n": n, "n_labels": L, "level": level, "n_resamples": n_resamples, "undefined": undefined}
|
|
285
|
+
return MultilabelReport(metrics, rows, settings)
|
|
272
286
|
|
|
273
287
|
|
|
274
288
|
# ------------------------------------------------------------------------------------------------- ranking
|
|
@@ -278,10 +292,13 @@ def _run_lists(run: Mapping[Any, Any]) -> dict[str, list[str]]:
|
|
|
278
292
|
out: dict[str, list[str]] = {}
|
|
279
293
|
for q, r in run.items():
|
|
280
294
|
if isinstance(r, Mapping): # doc -> score: by score, ties by document id descending (as trec_eval)
|
|
281
|
-
|
|
282
|
-
|
|
295
|
+
scored = [(float(s), str(d)) for d, s in r.items()]
|
|
296
|
+
if any(not math.isfinite(s) for s, _ in scored):
|
|
297
|
+
raise InputValidationError(f"Query {q!r}: document scores must be finite.")
|
|
298
|
+
ranked = [d for _, d in sorted(scored, reverse=True)]
|
|
283
299
|
else:
|
|
284
|
-
|
|
300
|
+
ranked = [str(d) for d in r]
|
|
301
|
+
out[str(q)] = list(dict.fromkeys(ranked)) # a document counts once, at its first (best) rank
|
|
285
302
|
return out
|
|
286
303
|
|
|
287
304
|
|
|
@@ -352,6 +369,12 @@ class RankingReport:
|
|
|
352
369
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
353
370
|
return json.dumps(self.to_dict(), indent=indent)
|
|
354
371
|
|
|
372
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
373
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
374
|
+
from .html_report import _markdown_tables
|
|
375
|
+
|
|
376
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
377
|
+
|
|
355
378
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
356
379
|
d = digits
|
|
357
380
|
ms = self.settings["metrics"]
|
|
@@ -93,6 +93,12 @@ class RAGReport:
|
|
|
93
93
|
def to_json(self, *, indent: Optional[int] = 2) -> str:
|
|
94
94
|
return json.dumps(self.to_dict(), indent=indent, allow_nan=False)
|
|
95
95
|
|
|
96
|
+
def to_html(self, *, digits: int = 3) -> str:
|
|
97
|
+
"""The Markdown tables as an HTML fragment (escaped), e.g. for :func:`evalsuite.html_report`."""
|
|
98
|
+
from .html_report import _markdown_tables
|
|
99
|
+
|
|
100
|
+
return _markdown_tables(self.to_markdown(digits=digits))
|
|
101
|
+
|
|
96
102
|
def to_markdown(self, *, digits: int = 3) -> str:
|
|
97
103
|
d = digits
|
|
98
104
|
rows = ["| Measure | Value | CI |", "| --- | ---: | --- |"]
|
|
@@ -183,11 +183,12 @@ def recalibrate(
|
|
|
183
183
|
n_bins: int = 10,
|
|
184
184
|
pos_label: Any = None,
|
|
185
185
|
sample_weight: Any = None,
|
|
186
|
+
classes: Any = None,
|
|
186
187
|
) -> Calibrator:
|
|
187
188
|
"""Fit a recalibration map on held-out labels and probabilities (see the module docstring for methods).
|
|
188
189
|
|
|
189
|
-
For ``method="temperature"`` ``y_prob`` may be an n × k probability matrix
|
|
190
|
-
|
|
190
|
+
For ``method="temperature"`` ``y_prob`` may be an n × k probability matrix: integer labels index the columns,
|
|
191
|
+
other labels map to the sorted labels unless ``classes=`` gives the label of each column."""
|
|
191
192
|
from scipy import optimize
|
|
192
193
|
|
|
193
194
|
if method not in _METHODS:
|
|
@@ -197,11 +198,25 @@ def recalibrate(
|
|
|
197
198
|
y = np.asarray(y_true)
|
|
198
199
|
if p_all.shape[0] != y.size or not np.all(np.isfinite(p_all)):
|
|
199
200
|
raise InputValidationError("y_prob must be a finite n × k matrix with one row per label.")
|
|
200
|
-
classes = np.unique(y)
|
|
201
201
|
k = p_all.shape[1]
|
|
202
|
-
if classes
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
if classes is not None:
|
|
203
|
+
order = list(np.asarray(classes).tolist())
|
|
204
|
+
if len(order) != k:
|
|
205
|
+
raise InputValidationError(f"classes has {len(order)} entries for {k} probability columns.")
|
|
206
|
+
elif np.issubdtype(y.dtype, np.integer):
|
|
207
|
+
order = list(range(k))
|
|
208
|
+
else:
|
|
209
|
+
order = sorted(set(y.tolist()))
|
|
210
|
+
if len(order) != k:
|
|
211
|
+
raise InputValidationError(
|
|
212
|
+
f"y_true has {len(order)} distinct labels but y_prob has {k} columns; pass classes= with the "
|
|
213
|
+
"label of each column."
|
|
214
|
+
)
|
|
215
|
+
pos = {c: i for i, c in enumerate(order)}
|
|
216
|
+
unknown = sorted({str(v) for v in y.tolist() if v not in pos})
|
|
217
|
+
if unknown:
|
|
218
|
+
raise InputValidationError(f"Labels not among the probability columns: {', '.join(unknown[:5])}.")
|
|
219
|
+
cols = np.array([pos[v] for v in y.tolist()])
|
|
205
220
|
logp = np.log(_clip(p_all))
|
|
206
221
|
|
|
207
222
|
def nll_k(log_t: float) -> float:
|
|
@@ -17,7 +17,7 @@ from ..core.result import _json_safe, _latex_escape, _latex_table
|
|
|
17
17
|
from ..core.types import ArrayLike
|
|
18
18
|
from ._resolve import MetricCall, as_items, as_observations, is_categorical, resolve_metric
|
|
19
19
|
from .effect import adjust_pvalues
|
|
20
|
-
from .intervals import _check_level, _check_resamples,
|
|
20
|
+
from .intervals import _check_level, _check_resamples, check_resampling, resampled_distributions
|
|
21
21
|
from .paired import delong_test, mcnemar_test
|
|
22
22
|
|
|
23
23
|
if TYPE_CHECKING:
|
|
@@ -347,26 +347,27 @@ def compare(
|
|
|
347
347
|
|
|
348
348
|
rng = np.random.default_rng(random_state)
|
|
349
349
|
use_strata = categorical if stratify is None else bool(stratify)
|
|
350
|
-
|
|
350
|
+
order = [(model, metric) for metric in metric_names for model in names]
|
|
351
|
+
dists = resampled_distributions(
|
|
352
|
+
[calls[k] for k in order], yt.shape[0], n_resamples, rng, yt if use_strata else None, resampling
|
|
353
|
+
)
|
|
351
354
|
a = (1 - level) / 2
|
|
352
355
|
boot: dict[tuple[str, str], np.ndarray] = {}
|
|
353
356
|
estimates: list[dict[str, Any]] = []
|
|
354
|
-
for metric in
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
)
|
|
357
|
+
for (model, metric), (dist, failed) in zip(order, dists):
|
|
358
|
+
call = calls[(model, metric)]
|
|
359
|
+
boot[(model, metric)] = dist
|
|
360
|
+
low, high = np.nanquantile(dist, [a, 1 - a])
|
|
361
|
+
estimates.append(
|
|
362
|
+
{
|
|
363
|
+
"model": model,
|
|
364
|
+
"metric": metric,
|
|
365
|
+
"estimate": call(),
|
|
366
|
+
"low": float(low),
|
|
367
|
+
"high": float(high),
|
|
368
|
+
"failed_resamples": int(failed),
|
|
369
|
+
}
|
|
370
|
+
)
|
|
370
371
|
|
|
371
372
|
pairs = (
|
|
372
373
|
[(m, baseline) for m in names if m != baseline]
|
|
@@ -99,6 +99,38 @@ def resample_indices(
|
|
|
99
99
|
return out
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
_CHUNK_ELEMENTS = 4_000_000 # resample indices held at once (32 MB of int64)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def resampled_distributions(
|
|
106
|
+
calls: list[MetricCall],
|
|
107
|
+
n: int,
|
|
108
|
+
n_resamples: int,
|
|
109
|
+
rng: np.random.Generator,
|
|
110
|
+
strata: Optional[NDArray[Any]],
|
|
111
|
+
resampling: str,
|
|
112
|
+
) -> list[tuple[NDArray[np.float64], int]]:
|
|
113
|
+
""":func:`bootstrap_distribution` of every call over the same :func:`resample_indices` (paired resamples).
|
|
114
|
+
Plain NumPy resamples are drawn in chunks so memory stays bounded; the draws, and so every result, are
|
|
115
|
+
identical to drawing them all at once."""
|
|
116
|
+
if strata is not None or resampling != "numpy":
|
|
117
|
+
idx = resample_indices(n, n_resamples, rng, strata, resampling)
|
|
118
|
+
return [bootstrap_distribution(c, idx) for c in calls]
|
|
119
|
+
step = max(1, min(n_resamples, _CHUNK_ELEMENTS // max(1, n)))
|
|
120
|
+
parts: list[list[NDArray[np.float64]]] = [[] for _ in calls]
|
|
121
|
+
failed = [0] * len(calls)
|
|
122
|
+
done = 0
|
|
123
|
+
while done < n_resamples:
|
|
124
|
+
rows = min(step, n_resamples - done)
|
|
125
|
+
idx = rng.integers(0, n, size=(rows, n))
|
|
126
|
+
for k, c in enumerate(calls):
|
|
127
|
+
vals, bad = bootstrap_distribution(c, idx)
|
|
128
|
+
parts[k].append(vals)
|
|
129
|
+
failed[k] += bad
|
|
130
|
+
done += rows
|
|
131
|
+
return [(np.concatenate(p), f) for p, f in zip(parts, failed)]
|
|
132
|
+
|
|
133
|
+
|
|
102
134
|
def bootstrap_distribution(call: MetricCall, indices: NDArray[np.int64]) -> tuple[NDArray[np.float64], int]:
|
|
103
135
|
"""Metric value on each resample; resamples where the metric is undefined become NaN."""
|
|
104
136
|
# Binary ROC AUC / average precision: every resample's curve in one parallel compiled call.
|
|
@@ -209,8 +241,9 @@ def bootstrap_ci(
|
|
|
209
241
|
metric_kwargs,
|
|
210
242
|
)
|
|
211
243
|
use_strata = call.categorical if stratify is None else bool(stratify)
|
|
212
|
-
|
|
213
|
-
|
|
244
|
+
((boot, failed),) = resampled_distributions(
|
|
245
|
+
[call], call.n, n_resamples, rng, call.y_true if use_strata else None, resampling
|
|
246
|
+
)
|
|
214
247
|
if failed > MAX_FAILED_FRACTION * n_resamples:
|
|
215
248
|
raise StatisticalTestError(
|
|
216
249
|
f"The metric was undefined on {failed} of {n_resamples} bootstrap resamples. The sample is probably "
|
|
@@ -22,11 +22,10 @@ from .intervals import (
|
|
|
22
22
|
_check_level,
|
|
23
23
|
_check_resamples,
|
|
24
24
|
binary_scores,
|
|
25
|
-
bootstrap_distribution,
|
|
26
25
|
check_resampling,
|
|
27
26
|
delong_covariance,
|
|
28
27
|
delong_placements,
|
|
29
|
-
|
|
28
|
+
resampled_distributions,
|
|
30
29
|
)
|
|
31
30
|
from .results import ConfidenceInterval, TestResult
|
|
32
31
|
|
|
@@ -175,9 +174,9 @@ def paired_bootstrap_test(
|
|
|
175
174
|
observed = call_a() - call_b()
|
|
176
175
|
rng = np.random.default_rng(random_state)
|
|
177
176
|
use_strata = call_a.categorical if stratify is None else bool(stratify)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
(da, fa), (db, fb) = resampled_distributions(
|
|
178
|
+
[call_a, call_b], call_a.n, n_resamples, rng, call_a.y_true if use_strata else None, resampling
|
|
179
|
+
)
|
|
181
180
|
diff = da - db
|
|
182
181
|
diff = diff[~np.isnan(diff)]
|
|
183
182
|
centred = diff - observed
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""1.3.5: bug clean and bounded-memory resampling."""
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
import evalsuite as es
|
|
7
|
+
|
|
8
|
+
E = es.InputValidationError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_ranking_counts_each_document_once_and_rejects_nan_scores():
|
|
12
|
+
rep = es.ranking_report({"q": {"d": 1}}, {"a": {"q": ["d", "d", "d"]}}, k=3, n_resamples=20, n_permutations=20)
|
|
13
|
+
pq = rep.per_query["a"]["q"]
|
|
14
|
+
assert pq["ap"] == 1.0 and pq["recall"] == 1.0 and pq["precision"] == pytest.approx(1 / 3)
|
|
15
|
+
with pytest.raises(E, match="finite"):
|
|
16
|
+
es.ranking_report({"q": {"d": 1}}, {"a": {"q": {"d": np.nan}}})
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_temperature_scaling_maps_string_labels_to_columns():
|
|
20
|
+
probs = np.array([[0.8, 0.1, 0.1], [0.1, 0.1, 0.8], [0.7, 0.2, 0.1], [0.2, 0.1, 0.7]])
|
|
21
|
+
labels = np.array(["x", "z", "x", "z"])
|
|
22
|
+
with pytest.raises(E, match="classes="):
|
|
23
|
+
es.recalibrate(labels, probs, method="temperature")
|
|
24
|
+
by_name = es.recalibrate(labels, probs, method="temperature", classes=["x", "y", "z"])
|
|
25
|
+
by_index = es.recalibrate(np.array([0, 2, 0, 2]), probs, method="temperature")
|
|
26
|
+
assert by_name.params["temperature"] == pytest.approx(by_index.params["temperature"])
|
|
27
|
+
with pytest.raises(E, match="not among"):
|
|
28
|
+
es.recalibrate(np.array(["x", "w", "x", "z"]), probs, method="temperature", classes=["x", "y", "z"])
|
|
29
|
+
with pytest.raises(E, match="entries"):
|
|
30
|
+
es.recalibrate(labels, probs, method="temperature", classes=["x", "z"])
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_undefined_multilabel_metrics_are_left_out():
|
|
34
|
+
rng = np.random.default_rng(0)
|
|
35
|
+
rep = es.multilabel_report(np.zeros((6, 3), int), y_score=rng.random((6, 3)), n_resamples=50)
|
|
36
|
+
assert "macro_roc_auc" not in rep.metrics and rep.settings["undefined"] == ["macro_roc_auc", "micro_roc_auc"]
|
|
37
|
+
assert "Undefined" in rep.summary()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_degenerate_inputs_give_clear_errors():
|
|
41
|
+
with pytest.raises(E, match="overflows"):
|
|
42
|
+
es.diebold_mariano([1e300, -1e300, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 2.0])
|
|
43
|
+
with pytest.raises(E, match="do not differ"):
|
|
44
|
+
es.icc([[1.0, 2.0], [1.0, 2.0], [1.0, 2.0]])
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_every_report_has_the_standard_exports():
|
|
48
|
+
import inspect
|
|
49
|
+
|
|
50
|
+
for name in es.__all__:
|
|
51
|
+
obj = getattr(es, name)
|
|
52
|
+
if inspect.isclass(obj) and hasattr(obj, "to_markdown") and name != "MetricResult":
|
|
53
|
+
for method in ("summary", "to_markdown", "to_json", "to_dict", "to_html"):
|
|
54
|
+
assert hasattr(obj, method), f"{name}.{method}"
|
|
55
|
+
rep = es.bayes_correlated_ttest([0.8, 0.82, 0.81], [0.79, 0.8, 0.8])
|
|
56
|
+
assert "<table>" in rep.to_html()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_chunked_resampling_equals_drawing_everything_at_once(monkeypatch):
|
|
60
|
+
from evalsuite.stats import intervals
|
|
61
|
+
|
|
62
|
+
rng = np.random.default_rng(1)
|
|
63
|
+
y = rng.integers(0, 2, 400)
|
|
64
|
+
p = np.where(rng.random(400) < 0.8, y, 1 - y)
|
|
65
|
+
prob = rng.random(400)
|
|
66
|
+
whole = es.bootstrap_ci(es.accuracy, y, p, stratify=False, random_state=3)
|
|
67
|
+
auc = es.bootstrap_ci(es.roc_auc, y, y_prob=prob, stratify=False, random_state=3)
|
|
68
|
+
test = es.paired_bootstrap_test(es.accuracy, y, p, 1 - p, stratify=False, random_state=3)
|
|
69
|
+
monkeypatch.setattr(intervals, "_CHUNK_ELEMENTS", 1000) # forces 2–3 resamples per chunk
|
|
70
|
+
again = es.bootstrap_ci(es.accuracy, y, p, stratify=False, random_state=3)
|
|
71
|
+
again_auc = es.bootstrap_ci(es.roc_auc, y, y_prob=prob, stratify=False, random_state=3)
|
|
72
|
+
assert (again.low, again.high) == (whole.low, whole.high)
|
|
73
|
+
assert (again_auc.low, again_auc.high) == (auc.low, auc.high)
|
|
74
|
+
assert str(es.paired_bootstrap_test(es.accuracy, y, p, 1 - p, stratify=False, random_state=3)) == str(test)
|
|
@@ -210,7 +210,7 @@ def test_recalibration_edges():
|
|
|
210
210
|
assert np.allclose(hist([0.1, 0.9]), y.mean())
|
|
211
211
|
with pytest.raises(E, match="n × k"):
|
|
212
212
|
es.recalibrate([0, 1], np.ones((3, 2)) / 2, method="temperature")
|
|
213
|
-
with pytest.raises(E, match="
|
|
213
|
+
with pytest.raises(E, match="not among"):
|
|
214
214
|
es.recalibrate([0, 1, 2], np.ones((3, 2)) / 2, method="temperature")
|
|
215
215
|
temp = es.recalibrate([0, 1, 1], np.array([[0.6, 0.4], [0.3, 0.7], [0.2, 0.8]]), method="temperature")
|
|
216
216
|
with pytest.raises(E, match="probability columns"):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|