evalsuite-python 0.8.0__py3-none-any.whl → 0.8.5__py3-none-any.whl
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/stats/intervals.py +2 -1
- evalsuite/text/retrieval.py +46 -14
- evalsuite/version.py +1 -1
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/METADATA +13 -7
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/RECORD +9 -9
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/WHEEL +0 -0
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/entry_points.txt +0 -0
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/licenses/LICENSE +0 -0
- {evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/licenses/LICENSE-APACHE +0 -0
evalsuite/stats/intervals.py
CHANGED
|
@@ -277,7 +277,8 @@ def proportion_ci(
|
|
|
277
277
|
denom = 1 + z**2 / n
|
|
278
278
|
centre = (p + z**2 / (2 * n)) / denom
|
|
279
279
|
half = z * math.sqrt(p * (1 - p) / n + z**2 / (4 * n**2)) / denom
|
|
280
|
-
|
|
280
|
+
# Rounding can leave a bound a hair past the estimate at 0 or n successes; the interval always holds it.
|
|
281
|
+
low, high = max(0.0, min(p, centre - half)), min(1.0, max(p, centre + half))
|
|
281
282
|
elif method == "clopper-pearson":
|
|
282
283
|
# Beta quantiles via the inverse regularised incomplete beta function (what scipy.stats.beta.ppf uses).
|
|
283
284
|
low = 0.0 if successes == 0 else special.betaincinv(successes, n - successes + 1, alpha / 2)
|
evalsuite/text/retrieval.py
CHANGED
|
@@ -13,6 +13,7 @@ from typing import Any, Optional
|
|
|
13
13
|
|
|
14
14
|
import numpy as np
|
|
15
15
|
|
|
16
|
+
from .._native import PY_SUM_COMPENSATED, core
|
|
16
17
|
from ..core.exceptions import InputValidationError
|
|
17
18
|
from ..core.registry import register
|
|
18
19
|
from ..core.result import MetricResult
|
|
@@ -68,7 +69,10 @@ def _finish(
|
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
def _need_relevant(q: list[tuple[Mapping[Any, float], list[Any]]], what: str) -> None:
|
|
71
|
-
|
|
72
|
+
_raise_empty([i for i, (rel, _) in enumerate(q) if not rel], what)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _raise_empty(empty: list[int], what: str) -> None:
|
|
72
76
|
if empty:
|
|
73
77
|
raise InputValidationError(
|
|
74
78
|
f"{what} is undefined for queries without relevant documents (queries {empty[:5]}); "
|
|
@@ -76,6 +80,24 @@ def _need_relevant(q: list[tuple[Mapping[Any, float], list[Any]]], what: str) ->
|
|
|
76
80
|
)
|
|
77
81
|
|
|
78
82
|
|
|
83
|
+
def _native_scores(
|
|
84
|
+
kind: str, relevant: Any, retrieved: Any, k: Optional[int], what: str = "", gains: str = "linear"
|
|
85
|
+
) -> Optional[list[float]]:
|
|
86
|
+
"""Per-query scores from the compiled core, which validates and looks up ids with Python's own dict / set
|
|
87
|
+
semantics and repeats the arithmetic below operation by operation (bit-identical); None without the core."""
|
|
88
|
+
c = core
|
|
89
|
+
if c is None:
|
|
90
|
+
return None
|
|
91
|
+
rel, ret = _seq(relevant, "relevant"), _seq(retrieved, "retrieved")
|
|
92
|
+
err, scores, empty = c.retrieval_scores(kind, rel, ret, k, gains == "exponential", PY_SUM_COMPENSATED)
|
|
93
|
+
if err is not None:
|
|
94
|
+
raise InputValidationError(err)
|
|
95
|
+
if what:
|
|
96
|
+
_raise_empty(empty, what)
|
|
97
|
+
scores_list: list[float] = scores
|
|
98
|
+
return scores_list
|
|
99
|
+
|
|
100
|
+
|
|
79
101
|
@register(
|
|
80
102
|
category=_C,
|
|
81
103
|
task="retrieval",
|
|
@@ -91,10 +113,10 @@ def _need_relevant(q: list[tuple[Mapping[Any, float], list[Any]]], what: str) ->
|
|
|
91
113
|
def precision_at_k(relevant: Any, retrieved: Any, *, k: int = 10, average: Optional[str] = "mean") -> MetricResult:
|
|
92
114
|
"""Mean Precision@k over queries."""
|
|
93
115
|
k = check_positive_int(k, "k")
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
116
|
+
scores = _native_scores("precision", relevant, retrieved, k)
|
|
117
|
+
if scores is None:
|
|
118
|
+
scores = [sum(d in rel for d in run[:k]) / k for rel, run in _queries(relevant, retrieved)]
|
|
119
|
+
return _finish("precision_at_k", f"Precision@{k}", scores, k, average)
|
|
98
120
|
|
|
99
121
|
|
|
100
122
|
@register(
|
|
@@ -111,11 +133,12 @@ def precision_at_k(relevant: Any, retrieved: Any, *, k: int = 10, average: Optio
|
|
|
111
133
|
def recall_at_k(relevant: Any, retrieved: Any, *, k: int = 10, average: Optional[str] = "mean") -> MetricResult:
|
|
112
134
|
"""Mean Recall@k over queries (every query needs at least one relevant document)."""
|
|
113
135
|
k = check_positive_int(k, "k")
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
136
|
+
scores = _native_scores("recall", relevant, retrieved, k, "Recall@k")
|
|
137
|
+
if scores is None:
|
|
138
|
+
q = _queries(relevant, retrieved)
|
|
139
|
+
_need_relevant(q, "Recall@k")
|
|
140
|
+
scores = [sum(d in rel for d in run[:k]) / len(rel) for rel, run in q]
|
|
141
|
+
return _finish("recall_at_k", f"Recall@{k}", scores, k, average)
|
|
119
142
|
|
|
120
143
|
|
|
121
144
|
@register(
|
|
@@ -132,10 +155,10 @@ def recall_at_k(relevant: Any, retrieved: Any, *, k: int = 10, average: Optional
|
|
|
132
155
|
def hit_rate_at_k(relevant: Any, retrieved: Any, *, k: int = 10, average: Optional[str] = "mean") -> MetricResult:
|
|
133
156
|
"""Hit rate@k (success@k)."""
|
|
134
157
|
k = check_positive_int(k, "k")
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
)
|
|
158
|
+
scores = _native_scores("hit", relevant, retrieved, k)
|
|
159
|
+
if scores is None:
|
|
160
|
+
scores = [float(any(d in rel for d in run[:k])) for rel, run in _queries(relevant, retrieved)]
|
|
161
|
+
return _finish("hit_rate_at_k", f"Hit rate@{k}", scores, k, average)
|
|
139
162
|
|
|
140
163
|
|
|
141
164
|
@register(
|
|
@@ -155,6 +178,9 @@ def mrr(
|
|
|
155
178
|
) -> MetricResult:
|
|
156
179
|
"""Mean reciprocal rank, optionally only within the top ``k``."""
|
|
157
180
|
k = _k(k)
|
|
181
|
+
native = _native_scores("mrr", relevant, retrieved, k)
|
|
182
|
+
if native is not None:
|
|
183
|
+
return _finish("mrr", "MRR" if k is None else f"MRR@{k}", native, k, average)
|
|
158
184
|
scores = []
|
|
159
185
|
for rel, run in _queries(relevant, retrieved):
|
|
160
186
|
rr = 0.0
|
|
@@ -184,6 +210,9 @@ def mean_average_precision_at_k(
|
|
|
184
210
|
) -> MetricResult:
|
|
185
211
|
"""MAP (``k=None``) or MAP@k: only the top ``k`` documents count, the denominator stays |relevant|."""
|
|
186
212
|
k = _k(k)
|
|
213
|
+
native = _native_scores("map", relevant, retrieved, k, "Average precision")
|
|
214
|
+
if native is not None:
|
|
215
|
+
return _finish("mean_average_precision_at_k", "MAP" if k is None else f"MAP@{k}", native, k, average)
|
|
187
216
|
q = _queries(relevant, retrieved)
|
|
188
217
|
_need_relevant(q, "Average precision")
|
|
189
218
|
scores = []
|
|
@@ -222,6 +251,9 @@ def ndcg_at_k(
|
|
|
222
251
|
k = _k(k)
|
|
223
252
|
if gains not in ("linear", "exponential"):
|
|
224
253
|
raise InputValidationError("gains must be 'linear' or 'exponential'.")
|
|
254
|
+
native = _native_scores("ndcg", relevant, retrieved, k, "NDCG", gains)
|
|
255
|
+
if native is not None:
|
|
256
|
+
return _finish("ndcg_at_k", "NDCG" if k is None else f"NDCG@{k}", native, k, average, gains=gains)
|
|
225
257
|
q = _queries(relevant, retrieved)
|
|
226
258
|
_need_relevant(q, "NDCG")
|
|
227
259
|
|
evalsuite/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.5
|
|
4
4
|
Summary: A unified Python framework for machine-learning, clinical, statistical, segmentation, object-detection, uncertainty, and model evaluation.
|
|
5
5
|
Project-URL: Homepage, https://evalsuite-nine.vercel.app
|
|
6
6
|
Project-URL: Documentation, https://evalsuite-nine.vercel.app/docs
|
|
@@ -85,7 +85,7 @@ Description-Content-Type: text/markdown
|
|
|
85
85
|
EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
|
|
86
86
|
evaluation into one consistent, validated, documented framework.
|
|
87
87
|
|
|
88
|
-
> **Status: stable (0.8.
|
|
88
|
+
> **Status: stable (0.8.5).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
89
89
|
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
90
90
|
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
91
91
|
> **0.7.0** moves ROC AUC / average precision (and so `evaluate()`), the LLM-systems consistency metrics,
|
|
@@ -93,7 +93,8 @@ evaluation into one consistent, validated, documented framework.
|
|
|
93
93
|
> **0.7.1** adds bootstrapped ROC AUC / AP (4–5× faster intervals), DeLong, QA exact match / F1,
|
|
94
94
|
> Hausdorff / surface distances, calibration and the WEAT permutation test.
|
|
95
95
|
> **0.8.0** adds a **full Rust edition on crates.io** ([`evalsuite`](https://crates.io/crates/evalsuite)): every
|
|
96
|
-
> metric
|
|
96
|
+
> metric, checked case by case against this package. **0.8.5** completes it (code complexity, CodeBLEU), adds
|
|
97
|
+
> the `evalsuite` command-line tool (`cargo install evalsuite-cli`) and runs the retrieval metrics on Rust (3×).
|
|
97
98
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
98
99
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
99
100
|
|
|
@@ -124,7 +125,8 @@ the default NumPy one, so interval endpoints and p-values differ slightly (stati
|
|
|
124
125
|
|
|
125
126
|
### Rust
|
|
126
127
|
|
|
127
|
-
The same metrics are available as a pure-Rust crate, verified against this package on 36,
|
|
128
|
+
The same metrics are available as a pure-Rust crate, verified against this package on 36,514 recorded cases,
|
|
129
|
+
and as a standalone command (`cargo install evalsuite-cli`):
|
|
128
130
|
|
|
129
131
|
```toml
|
|
130
132
|
[dependencies]
|
|
@@ -135,8 +137,12 @@ evalsuite = "0.8"
|
|
|
135
137
|
let acc = evalsuite::classification::accuracy(&[1, 0, 1, 1], &[1, 0, 0, 1], None).unwrap(); // 0.75
|
|
136
138
|
```
|
|
137
139
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
```bash
|
|
141
|
+
evalsuite evaluate preds.csv --y-true label --y-pred pred --y-prob score
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
See [rust/evalsuite/README.md](rust/evalsuite/README.md) for the module list, performance and the few
|
|
145
|
+
documented differences, and [rust/evalsuite-cli/README.md](rust/evalsuite-cli/README.md) for the command.
|
|
140
146
|
|
|
141
147
|
## Why EvalSuite
|
|
142
148
|
|
|
@@ -525,7 +531,7 @@ fallback; `tests/test_native.py` checks that the two give identical results. See
|
|
|
525
531
|
## Links
|
|
526
532
|
|
|
527
533
|
- PyPI: https://pypi.org/project/evalsuite-python/
|
|
528
|
-
- crates.io: https://crates.io/crates/evalsuite
|
|
534
|
+
- crates.io: https://crates.io/crates/evalsuite (library), https://crates.io/crates/evalsuite-cli (command)
|
|
529
535
|
- Website and documentation: https://evalsuite-nine.vercel.app
|
|
530
536
|
- Website source: https://github.com/mkcs28/evalsuite
|
|
531
537
|
|
|
@@ -9,7 +9,7 @@ evalsuite/calibration.py,sha256=jhCPOmCFGEkUkcx-hSAIb-JCMq9oF6JZt4uDGvg5NaU,1508
|
|
|
9
9
|
evalsuite/plot.py,sha256=7eOyzoRbg6Aad6OhtIQG3laIioQ8fs2K0YzodjG5rHA,26049
|
|
10
10
|
evalsuite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
evalsuite/reporting.py,sha256=-LISv9vvEnltT26GtzLjVlxOCcAwmjv4-HyB8_1UF5o,9615
|
|
12
|
-
evalsuite/version.py,sha256=
|
|
12
|
+
evalsuite/version.py,sha256=XFdkp1QuHle3SwH0TCK3aNnQGhnvsSVGa-hkiAwDkiQ,98
|
|
13
13
|
evalsuite/classification/__init__.py,sha256=ErBIXbBGnhfW6v-1Cn5SegiERoyxNlmO1tEKcLM15mA,833
|
|
14
14
|
evalsuite/classification/_common.py,sha256=3ANV33ix_mnOzvOAG8glyJO-iYVhhTGO0S3YG0ZddB8,4543
|
|
15
15
|
evalsuite/classification/metrics.py,sha256=cP9TAVVk6Pob2VUuxMfQpOakzVmuMOXzGzqO2oGhED8,40575
|
|
@@ -43,7 +43,7 @@ evalsuite/stats/_resolve.py,sha256=a2Z9rCJ7yNdsIxlCypk94h7Ho-Vewg2ygHahNa7scBU,1
|
|
|
43
43
|
evalsuite/stats/compare.py,sha256=ooO5STzocKrqNsxKvm_C4Bl1c36_7fziCJc-d2cJASA,18531
|
|
44
44
|
evalsuite/stats/effect.py,sha256=bgnhdCI4vU_Wnv5q7G2ncmtN3n7N1GWiYO4iO3FDI0w,7286
|
|
45
45
|
evalsuite/stats/hypothesis.py,sha256=RCu8yPTOhtetFQ5TlZQWaFu2t-aq56ffaNlEqC-lJbg,24546
|
|
46
|
-
evalsuite/stats/intervals.py,sha256=
|
|
46
|
+
evalsuite/stats/intervals.py,sha256=NRYwa68nt2EyN68_-OMOP6bxQPOPifILk-mjE-yIjJI,17751
|
|
47
47
|
evalsuite/stats/paired.py,sha256=guPwpss0XQWRzL4hWL9xE4mgF6bUQQ2FbkNMkyhxrlc,8663
|
|
48
48
|
evalsuite/stats/results.py,sha256=nqXHUiW8l0fQJkbMiunU6Gz-2be1NApZ6Fif2B1K_Yw,4407
|
|
49
49
|
evalsuite/text/__init__.py,sha256=_r0Qi6X7cBcaYMAPRyC15CsTj9Tv8VcqMCtLiSJPogY,3632
|
|
@@ -55,16 +55,16 @@ evalsuite/text/qa.py,sha256=ZInaTXzQjxvliu1b2ArcX74OW1UPLXPvYcHGeIgVQH8,5197
|
|
|
55
55
|
evalsuite/text/rag.py,sha256=GF8GUp6Vnt9peBCIcdvFUapLUL36_NDApZisYG_rcqg,9641
|
|
56
56
|
evalsuite/text/reasoning.py,sha256=Z-c66yq5ADiNHh9ZROIvqh1ACwCJ0c3Q7Q0ciA0OS_0,10254
|
|
57
57
|
evalsuite/text/report.py,sha256=nUAgt24rcQsnPLiNTVn3PlzZO3Y7fW_ch_lSelgfEc8,6241
|
|
58
|
-
evalsuite/text/retrieval.py,sha256=
|
|
58
|
+
evalsuite/text/retrieval.py,sha256=yHzb4WSvgbzwf291P8JPWG7HhZHn3NwVIABBnd3aDCI,10745
|
|
59
59
|
evalsuite/text/semantic.py,sha256=TgBBDcRll7vMzQVYStgt1SS9G7e6FTf7SuZDcPL32_g,23004
|
|
60
60
|
evalsuite/text/spice.py,sha256=rdPCeilqKkXLMiSAE-rYOn0Zt2nKFum5Tf1oJdE6k-U,6847
|
|
61
61
|
evalsuite/text/structured.py,sha256=x08yYf2rdlmiA_D_dI1L-fc9quHiBPMKgAGQbG3kJr8,31981
|
|
62
62
|
evalsuite/vision/__init__.py,sha256=9gpOBTPveM_srE6BM-SgCssdQurya2LPHhoMLGOh2A0,991
|
|
63
63
|
evalsuite/vision/detection.py,sha256=Cjr-Y5-pV0wiQk1JiHLYvDdKzMlCEvVQarzY7fqGWw4,32010
|
|
64
64
|
evalsuite/vision/segmentation.py,sha256=tYYsBfEYdPvi94k3dJgp8ODn8X0qKsLW5QAv7KuQMj0,41953
|
|
65
|
-
evalsuite_python-0.8.
|
|
66
|
-
evalsuite_python-0.8.
|
|
67
|
-
evalsuite_python-0.8.
|
|
68
|
-
evalsuite_python-0.8.
|
|
69
|
-
evalsuite_python-0.8.
|
|
70
|
-
evalsuite_python-0.8.
|
|
65
|
+
evalsuite_python-0.8.5.dist-info/METADATA,sha256=_UkMaWOxRgPrdv31WIJoOGupsL6Yoi7kUKUSLQ2lM5Q,30297
|
|
66
|
+
evalsuite_python-0.8.5.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
67
|
+
evalsuite_python-0.8.5.dist-info/entry_points.txt,sha256=YYIwisn4L4sQt3ntzbM0_Z4yZE2KCu3GJ6KfWL1kIwc,54
|
|
68
|
+
evalsuite_python-0.8.5.dist-info/licenses/LICENSE,sha256=cRRQ6Kk8w2qCqtDSSUJQGy-0rqjmjJG09cZ6iIiMvdc,1095
|
|
69
|
+
evalsuite_python-0.8.5.dist-info/licenses/LICENSE-APACHE,sha256=K4pWYv3dt61u1BuIxjOGBxhgRkpsH4X_dzeIbOILXw0,10784
|
|
70
|
+
evalsuite_python-0.8.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{evalsuite_python-0.8.0.dist-info → evalsuite_python-0.8.5.dist-info}/licenses/LICENSE-APACHE
RENAMED
|
File without changes
|