evalsuite-python 0.6.1__py3-none-any.whl → 0.7.1__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/classification/metrics.py +87 -5
- evalsuite/llmsys/_common.py +34 -0
- evalsuite/llmsys/agents.py +6 -1
- evalsuite/llmsys/longcontext.py +30 -11
- evalsuite/llmsys/multilingual.py +17 -8
- evalsuite/llmsys/robustness.py +23 -12
- evalsuite/llmsys/safety.py +60 -11
- evalsuite/stats/_resolve.py +73 -1
- evalsuite/stats/intervals.py +20 -3
- evalsuite/text/factuality.py +10 -1
- evalsuite/text/judge.py +18 -9
- evalsuite/text/qa.py +25 -2
- evalsuite/text/reasoning.py +35 -7
- evalsuite/version.py +1 -1
- evalsuite/vision/segmentation.py +17 -1
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/METADATA +49 -43
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/RECORD +21 -21
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/WHEEL +0 -0
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/entry_points.txt +0 -0
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/licenses/LICENSE +0 -0
- {evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/licenses/LICENSE-APACHE +0 -0
|
@@ -16,6 +16,7 @@ from typing import Any, Literal, Optional
|
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
|
|
19
|
+
from .._native import array_view, core
|
|
19
20
|
from ..core.context import ClassificationContext
|
|
20
21
|
from ..core.exceptions import InputValidationError, MetricInputError, UnsupportedTaskError
|
|
21
22
|
from ..core.registry import register
|
|
@@ -548,7 +549,48 @@ def _require_both_classes(tps: FloatArray, fps: FloatArray, what: str) -> None:
|
|
|
548
549
|
)
|
|
549
550
|
|
|
550
551
|
|
|
552
|
+
CurveStats = tuple[float, float, float, float]
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
def _native_curves(columns: list[tuple[FloatArray, FloatArray, FloatArray]]) -> list[CurveStats]:
|
|
556
|
+
"""(ROC AUC, AP, positive weight, negative weight) of each (y, score, w) column, from the compiled core: one
|
|
557
|
+
stable sort per column, columns in parallel, bit for bit as ``_binary_curve`` + ``_binary_auc``/``_ap``."""
|
|
558
|
+
c = core
|
|
559
|
+
if c is None: # pragma: no cover - callers check
|
|
560
|
+
raise RuntimeError("compiled core unavailable")
|
|
561
|
+
keep = []
|
|
562
|
+
views = []
|
|
563
|
+
for col in columns:
|
|
564
|
+
triple = []
|
|
565
|
+
for a in col:
|
|
566
|
+
arr, v = array_view(a, np.float64)
|
|
567
|
+
keep.append(arr)
|
|
568
|
+
triple.append(v)
|
|
569
|
+
views.append(tuple(triple))
|
|
570
|
+
out: list[CurveStats] = c.curve_scores(views)
|
|
571
|
+
return out
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def _auc_of(stats: CurveStats) -> float:
|
|
575
|
+
auc, _, tp, fp = stats
|
|
576
|
+
if tp == 0 or fp == 0:
|
|
577
|
+
missing = "positive" if tp == 0 else "negative"
|
|
578
|
+
raise MetricInputError(
|
|
579
|
+
f"ROC AUC is undefined because y_true contains no {missing} observations. "
|
|
580
|
+
"It needs at least one positive and one negative example."
|
|
581
|
+
)
|
|
582
|
+
return float(auc)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
def _ap_of(stats: CurveStats) -> float:
|
|
586
|
+
if stats[2] == 0:
|
|
587
|
+
raise MetricInputError("Average precision is undefined because y_true contains no positive observations.")
|
|
588
|
+
return float(stats[1])
|
|
589
|
+
|
|
590
|
+
|
|
551
591
|
def _binary_auc(y: FloatArray, score: FloatArray, w: FloatArray) -> float:
|
|
592
|
+
if core is not None and y.size:
|
|
593
|
+
return _auc_of(_native_curves([(y, score, w)])[0])
|
|
552
594
|
fps, tps, _ = _binary_curve(y, score, w)
|
|
553
595
|
_require_both_classes(tps, fps, "ROC AUC")
|
|
554
596
|
fpr = np.r_[0.0, fps / fps[-1]]
|
|
@@ -558,6 +600,8 @@ def _binary_auc(y: FloatArray, score: FloatArray, w: FloatArray) -> float:
|
|
|
558
600
|
|
|
559
601
|
|
|
560
602
|
def _binary_ap(y: FloatArray, score: FloatArray, w: FloatArray) -> float:
|
|
603
|
+
if core is not None and y.size:
|
|
604
|
+
return _ap_of(_native_curves([(y, score, w)])[0])
|
|
561
605
|
fps, tps, _ = _binary_curve(y, score, w)
|
|
562
606
|
if tps[-1] == 0:
|
|
563
607
|
raise MetricInputError("Average precision is undefined because y_true contains no positive observations.")
|
|
@@ -606,6 +650,21 @@ def roc_auc(
|
|
|
606
650
|
return _roc_auc(ctx, average=average, multi_class=multi_class, pos_label=pos_label)
|
|
607
651
|
|
|
608
652
|
|
|
653
|
+
def _context_curves(ctx: ClassificationContext, key: str, columns: Any) -> list[CurveStats]:
|
|
654
|
+
cache = ctx.__dict__.setdefault("_curve_cache", {})
|
|
655
|
+
if key not in cache:
|
|
656
|
+
cache[key] = _native_curves(columns())
|
|
657
|
+
out: list[CurveStats] = cache[key]
|
|
658
|
+
return out
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def _binary_curve_stats(ctx: ClassificationContext, pos_label: Any) -> CurveStats:
|
|
662
|
+
idx = positive_index(ctx, pos_label)
|
|
663
|
+
return _context_curves(
|
|
664
|
+
ctx, f"binary:{idx}", lambda: [(_binary_target(ctx, pos_label), ctx.y_prob, ctx.weights)]
|
|
665
|
+
)[0]
|
|
666
|
+
|
|
667
|
+
|
|
609
668
|
def _per_column(
|
|
610
669
|
ctx: ClassificationContext,
|
|
611
670
|
fn: Any,
|
|
@@ -622,9 +681,19 @@ def _per_column(
|
|
|
622
681
|
if ctx.target_type == "multilabel"
|
|
623
682
|
else (ctx.true_idx[:, None] == np.arange(ctx.labels.shape[0])[None, :]).astype(float)
|
|
624
683
|
)
|
|
684
|
+
native = core is not None and fn in (_binary_auc, _binary_ap) and y.size > 0
|
|
685
|
+
pick = _auc_of if fn is _binary_auc else _ap_of
|
|
625
686
|
if average == "micro":
|
|
687
|
+
if native:
|
|
688
|
+
# ROC AUC and AP share one sort: the curves are cached on the context for the other metric.
|
|
689
|
+
stats = _context_curves(ctx, "micro", lambda: [(y.ravel(), p.ravel(), np.repeat(w, y.shape[1]))])
|
|
690
|
+
return MetricResult(metric, name, pick(stats[0]), params)
|
|
626
691
|
return MetricResult(metric, name, fn(y.ravel(), p.ravel(), np.repeat(w, y.shape[1])), params)
|
|
627
|
-
|
|
692
|
+
if native:
|
|
693
|
+
stats = _context_curves(ctx, "columns", lambda: [(y[:, j], p[:, j], w) for j in range(y.shape[1])])
|
|
694
|
+
scores = np.array([pick(st) for st in stats])
|
|
695
|
+
else:
|
|
696
|
+
scores = np.array([fn(y[:, j], p[:, j], w) for j in range(y.shape[1])])
|
|
628
697
|
if average is None:
|
|
629
698
|
return MetricResult(metric, name, scores, params, labels=tuple(ctx.labels.tolist()))
|
|
630
699
|
if average == "macro":
|
|
@@ -644,6 +713,8 @@ def _roc_auc(
|
|
|
644
713
|
params: dict[str, Any] = {"average": avg}
|
|
645
714
|
if ctx.target_type == "binary":
|
|
646
715
|
params["pos_label"] = 1 if pos_label is None else pos_label
|
|
716
|
+
if core is not None and ctx.n:
|
|
717
|
+
return MetricResult("roc_auc", "ROC AUC", _auc_of(_binary_curve_stats(ctx, pos_label)), params)
|
|
647
718
|
return MetricResult(
|
|
648
719
|
"roc_auc", "ROC AUC", _binary_auc(_binary_target(ctx, pos_label), ctx.y_prob, ctx.weights), params
|
|
649
720
|
)
|
|
@@ -712,6 +783,10 @@ def _average_precision(
|
|
|
712
783
|
params: dict[str, Any] = {"average": avg}
|
|
713
784
|
if ctx.target_type == "binary":
|
|
714
785
|
params["pos_label"] = 1 if pos_label is None else pos_label
|
|
786
|
+
if core is not None and ctx.n:
|
|
787
|
+
return MetricResult(
|
|
788
|
+
"average_precision", "Average precision", _ap_of(_binary_curve_stats(ctx, pos_label)), params
|
|
789
|
+
)
|
|
715
790
|
return MetricResult(
|
|
716
791
|
"average_precision",
|
|
717
792
|
"Average precision",
|
|
@@ -905,10 +980,17 @@ def calibration_curve(
|
|
|
905
980
|
edges = np.quantile(p, np.linspace(0, 1, n_bins + 1))
|
|
906
981
|
else:
|
|
907
982
|
raise InputValidationError("strategy must be 'uniform' or 'quantile'.")
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
983
|
+
c = core
|
|
984
|
+
if c is not None and not np.isnan(edges).any():
|
|
985
|
+
# Bin search and the three weighted bin sums in one compiled pass, in input order as np.bincount.
|
|
986
|
+
views = [array_view(a, np.float64) for a in (y, p, w)]
|
|
987
|
+
sums = c.calibration_bins(*(v for _, v in views), [float(e) for e in edges[1:-1]])
|
|
988
|
+
bin_w, bin_true, bin_pred = (np.array(x) for x in sums)
|
|
989
|
+
else:
|
|
990
|
+
idx = np.searchsorted(edges[1:-1], p, side="right")
|
|
991
|
+
bin_w = np.bincount(idx, weights=w, minlength=len(edges))
|
|
992
|
+
bin_true = np.bincount(idx, weights=w * y, minlength=len(edges))
|
|
993
|
+
bin_pred = np.bincount(idx, weights=w * p, minlength=len(edges))
|
|
912
994
|
keep = bin_w > 0
|
|
913
995
|
return bin_true[keep] / bin_w[keep], bin_pred[keep] / bin_w[keep], bin_w[keep]
|
|
914
996
|
|
evalsuite/llmsys/_common.py
CHANGED
|
@@ -8,6 +8,7 @@ from typing import Any, Optional
|
|
|
8
8
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
|
|
11
|
+
from .._native import Vocab, core
|
|
11
12
|
from ..core.exceptions import InputValidationError
|
|
12
13
|
from ..core.result import MetricResult
|
|
13
14
|
|
|
@@ -213,3 +214,36 @@ def lists_of(x: Any, name: str) -> list[list[Any]]:
|
|
|
213
214
|
raise InputValidationError(f"{name}[{i}] must be a list.")
|
|
214
215
|
out.append(list(r))
|
|
215
216
|
return out
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
GroupStats = tuple[bool, int, int, int, int] # unanimous, equal pairs, pairs, modal count, mode id
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def group_agreement(groups: list[list[Any]]) -> Optional[tuple[list[GroupStats], list[Any]]]:
|
|
223
|
+
"""Per group of (already normalised) answers, from the compiled core: whether all agree, the number of equal
|
|
224
|
+
and of all unordered pairs, the modal count and the modal answer (first seen among ties). Returns the stats
|
|
225
|
+
and the id -> answer table, or None when the core is unavailable or an answer is not a string (the callers
|
|
226
|
+
then use their Python loops, whose ``==`` semantics for other types the ids would not reproduce)."""
|
|
227
|
+
c = core
|
|
228
|
+
if c is None or not all(type(a) is str for g in groups for a in g):
|
|
229
|
+
return None
|
|
230
|
+
v = Vocab()
|
|
231
|
+
stats: list[GroupStats] = c.group_stats([v.encode(g) for g in groups])
|
|
232
|
+
return stats, list(v.ids)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
RowStats = tuple[float, float, float, int] # NumPy sum, min, max, count > 0
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def ragged_numbers(rows: list[Any]) -> Optional[list[RowStats]]:
|
|
239
|
+
"""Per-row (NumPy sum, min, max, count > 0) of rows of numbers, read directly by the compiled core. None (the
|
|
240
|
+
caller uses its Python loop, with its own conversions and validation messages) without the core, for rows
|
|
241
|
+
that are not sequences of numbers, or when a value is NaN or infinite."""
|
|
242
|
+
c = core
|
|
243
|
+
if c is None:
|
|
244
|
+
return None
|
|
245
|
+
try:
|
|
246
|
+
stats: Optional[list[RowStats]] = c.ragged_stats(rows)
|
|
247
|
+
except (TypeError, ValueError, OverflowError):
|
|
248
|
+
return None
|
|
249
|
+
return stats
|
evalsuite/llmsys/agents.py
CHANGED
|
@@ -74,8 +74,13 @@ def _trajectories(x: Any, name: str = "trajectories") -> list[list[dict[str, Any
|
|
|
74
74
|
return out
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
# One reusable encoder: json.dumps(..., sort_keys=True, default=str) builds a new encoder on every call, which
|
|
78
|
+
# dominated the tool-call metrics; the output is byte-identical.
|
|
79
|
+
_KEY_ENCODER = json.JSONEncoder(sort_keys=True, default=str)
|
|
80
|
+
|
|
81
|
+
|
|
77
82
|
def _key(call: Mapping[str, Any]) -> str:
|
|
78
|
-
return
|
|
83
|
+
return _KEY_ENCODER.encode([call["name"], call["arguments"]])
|
|
79
84
|
|
|
80
85
|
|
|
81
86
|
@register(
|
evalsuite/llmsys/longcontext.py
CHANGED
|
@@ -15,7 +15,7 @@ import numpy as np
|
|
|
15
15
|
from ..core.exceptions import InputValidationError
|
|
16
16
|
from ..core.registry import register
|
|
17
17
|
from ..core.result import MetricResult
|
|
18
|
-
from ._common import bools, floats, lists_of, rate, same_length, seq
|
|
18
|
+
from ._common import bools, floats, group_agreement, lists_of, ragged_numbers, rate, same_length, seq
|
|
19
19
|
|
|
20
20
|
__all__ = [
|
|
21
21
|
"citation_coverage",
|
|
@@ -321,10 +321,19 @@ def compression_ratio(
|
|
|
321
321
|
def citation_coverage(citations_per_statement: Any) -> MetricResult:
|
|
322
322
|
"""``citations_per_statement``: per output, the number of citations attached to each statement."""
|
|
323
323
|
rows = lists_of(citations_per_statement, "citations_per_statement")
|
|
324
|
-
|
|
325
|
-
if
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
native = ragged_numbers(rows)
|
|
325
|
+
if native is not None:
|
|
326
|
+
total = sum(map(len, rows))
|
|
327
|
+
if total == 0:
|
|
328
|
+
raise InputValidationError("No statements given.")
|
|
329
|
+
flat = np.zeros(total, dtype=bool)
|
|
330
|
+
flat[: sum(st[3] for st in native)] = True # rate() uses only the count and the total
|
|
331
|
+
per = [st[3] / len(r) for st, r in zip(native, rows) if r]
|
|
332
|
+
else:
|
|
333
|
+
flat = np.array([float(v) > 0 for r in rows for v in r])
|
|
334
|
+
if flat.size == 0:
|
|
335
|
+
raise InputValidationError("No statements given.")
|
|
336
|
+
per = [np.mean([float(v) > 0 for v in r]) for r in rows if r]
|
|
328
337
|
return rate("citation_coverage", "Citation coverage", flat, {"mean_per_output": float(np.mean(per))})
|
|
329
338
|
|
|
330
339
|
|
|
@@ -343,16 +352,26 @@ def cross_document_consistency(answers: Any, *, normalize: Optional[Callable[[An
|
|
|
343
352
|
from itertools import combinations
|
|
344
353
|
|
|
345
354
|
rows = seq(answers, "answers")
|
|
346
|
-
|
|
355
|
+
normed = []
|
|
347
356
|
for i, r in enumerate(rows):
|
|
348
357
|
vals = list(r.values()) if isinstance(r, Mapping) else list(r) if isinstance(r, (list, tuple)) else None
|
|
349
358
|
if vals is None or len(vals) < 2:
|
|
350
359
|
raise InputValidationError(f"answers[{i}] needs at least two answers.")
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
360
|
+
normed.append(
|
|
361
|
+
[
|
|
362
|
+
normalize(a) if normalize else (" ".join(a.lower().split()) if isinstance(a, str) else a)
|
|
363
|
+
for a in vals
|
|
364
|
+
]
|
|
365
|
+
)
|
|
366
|
+
native = group_agreement(normed)
|
|
367
|
+
if native is not None:
|
|
368
|
+
full = [st[0] for st in native[0]]
|
|
369
|
+
pair = [st[1] / st[2] for st in native[0]]
|
|
370
|
+
else:
|
|
371
|
+
full, pair = [], []
|
|
372
|
+
for v in normed:
|
|
373
|
+
full.append(all(x == v[0] for x in v))
|
|
374
|
+
pair.append(np.mean([x == y for x, y in combinations(v, 2)]))
|
|
356
375
|
return MetricResult(
|
|
357
376
|
"cross_document_consistency",
|
|
358
377
|
"Cross-document consistency",
|
evalsuite/llmsys/multilingual.py
CHANGED
|
@@ -17,7 +17,7 @@ import numpy as np
|
|
|
17
17
|
from ..core.exceptions import InputValidationError
|
|
18
18
|
from ..core.registry import register
|
|
19
19
|
from ..core.result import MetricResult
|
|
20
|
-
from ._common import bools, by_group, floats, rate, same_length, seq
|
|
20
|
+
from ._common import bools, by_group, floats, group_agreement, rate, same_length, seq
|
|
21
21
|
|
|
22
22
|
__all__ = [
|
|
23
23
|
"bitext_mining_accuracy",
|
|
@@ -321,16 +321,25 @@ def cross_lingual_consistency(
|
|
|
321
321
|
) -> MetricResult:
|
|
322
322
|
"""``answers_by_language``: per question, a mapping language -> answer (at least two languages)."""
|
|
323
323
|
rows = seq(answers_by_language, "answers_by_language")
|
|
324
|
-
|
|
324
|
+
normed = []
|
|
325
325
|
for i, r in enumerate(rows):
|
|
326
326
|
if not isinstance(r, Mapping) or len(r) < 2:
|
|
327
327
|
raise InputValidationError(f"answers_by_language[{i}] must map at least two languages to answers.")
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
328
|
+
normed.append(
|
|
329
|
+
[
|
|
330
|
+
normalize(a) if normalize else (" ".join(a.lower().split()) if isinstance(a, str) else a)
|
|
331
|
+
for a in r.values()
|
|
332
|
+
]
|
|
333
|
+
)
|
|
334
|
+
native = group_agreement(normed)
|
|
335
|
+
if native is not None:
|
|
336
|
+
full = [st[0] for st in native[0]]
|
|
337
|
+
pair = [st[1] / st[2] for st in native[0]]
|
|
338
|
+
else:
|
|
339
|
+
full, pair = [], []
|
|
340
|
+
for v in normed:
|
|
341
|
+
full.append(all(x == v[0] for x in v))
|
|
342
|
+
pair.append(np.mean([x == y for x, y in combinations(v, 2)]))
|
|
334
343
|
return MetricResult(
|
|
335
344
|
"cross_lingual_consistency",
|
|
336
345
|
"Cross-lingual consistency",
|
evalsuite/llmsys/robustness.py
CHANGED
|
@@ -19,7 +19,7 @@ import numpy as np
|
|
|
19
19
|
from ..core.exceptions import InputValidationError
|
|
20
20
|
from ..core.registry import register
|
|
21
21
|
from ..core.result import MetricResult
|
|
22
|
-
from ._common import bools, floats, lists_of, rate, same_length, seq
|
|
22
|
+
from ._common import bools, floats, group_agreement, lists_of, rate, same_length, seq
|
|
23
23
|
|
|
24
24
|
__all__ = [
|
|
25
25
|
"add_typos",
|
|
@@ -198,11 +198,16 @@ def paraphrase_consistency(answers: Any, *, normalize: Optional[Callable[[Any],
|
|
|
198
198
|
rows = lists_of(answers, "answers")
|
|
199
199
|
if any(len(r) < 2 for r in rows):
|
|
200
200
|
raise InputValidationError("Every item needs answers to at least two paraphrases.")
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
full
|
|
205
|
-
pair
|
|
201
|
+
normed = [[_norm(a, normalize) for a in r] for r in rows]
|
|
202
|
+
native = group_agreement(normed)
|
|
203
|
+
if native is not None:
|
|
204
|
+
full = [st[0] for st in native[0]]
|
|
205
|
+
pair = [st[1] / st[2] for st in native[0]]
|
|
206
|
+
else:
|
|
207
|
+
full, pair = [], []
|
|
208
|
+
for v in normed:
|
|
209
|
+
full.append(all(x == v[0] for x in v))
|
|
210
|
+
pair.append(np.mean([x == y for x, y in combinations(v, 2)]))
|
|
206
211
|
return MetricResult(
|
|
207
212
|
"paraphrase_consistency",
|
|
208
213
|
"Paraphrase consistency",
|
|
@@ -321,12 +326,18 @@ def response_stability(samples: Any, *, normalize: Optional[Callable[[Any], Any]
|
|
|
321
326
|
rows = lists_of(samples, "samples")
|
|
322
327
|
if any(len(r) < 2 for r in rows):
|
|
323
328
|
raise InputValidationError("Every prompt needs at least two samples.")
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
pair
|
|
328
|
-
unanimous
|
|
329
|
-
modal
|
|
329
|
+
normed = [[_norm(a, normalize) for a in r] for r in rows]
|
|
330
|
+
native = group_agreement(normed)
|
|
331
|
+
if native is not None:
|
|
332
|
+
pair = [st[1] / st[2] for st in native[0]]
|
|
333
|
+
unanimous = [st[0] for st in native[0]]
|
|
334
|
+
modal = [st[3] / len(v) for st, v in zip(native[0], normed)]
|
|
335
|
+
else:
|
|
336
|
+
pair, unanimous, modal = [], [], []
|
|
337
|
+
for v in normed:
|
|
338
|
+
pair.append(np.mean([x == y for x, y in combinations(v, 2)]))
|
|
339
|
+
unanimous.append(all(x == v[0] for x in v))
|
|
340
|
+
modal.append(Counter(map(repr, v)).most_common(1)[0][1] / len(v))
|
|
330
341
|
return MetricResult(
|
|
331
342
|
"response_stability",
|
|
332
343
|
"Response stability",
|
evalsuite/llmsys/safety.py
CHANGED
|
@@ -15,10 +15,11 @@ from typing import Any, Optional
|
|
|
15
15
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
|
|
18
|
+
from .._native import core
|
|
18
19
|
from ..core.exceptions import InputValidationError
|
|
19
20
|
from ..core.registry import register
|
|
20
21
|
from ..core.result import MetricResult
|
|
21
|
-
from ._common import bools, by_group, floats, lists_of, rate, same_length, seq, wilson
|
|
22
|
+
from ._common import bools, by_group, floats, lists_of, ragged_numbers, rate, same_length, seq, wilson
|
|
22
23
|
|
|
23
24
|
__all__ = [
|
|
24
25
|
"PII_PATTERNS",
|
|
@@ -236,6 +237,10 @@ def toxicity_score(scores: Any, *, threshold: float = 0.5, attributes: Any = Non
|
|
|
236
237
|
|
|
237
238
|
def maxima(x: Any, name: str) -> np.ndarray:
|
|
238
239
|
rows = seq(x, name)
|
|
240
|
+
wrapped = [r if isinstance(r, (list, tuple, np.ndarray)) else [r] for r in rows]
|
|
241
|
+
stats = ragged_numbers(wrapped)
|
|
242
|
+
if stats is not None and all(len(r) for r in wrapped) and all(st[1] >= 0 and st[2] <= 1 for st in stats):
|
|
243
|
+
return np.array([st[2] for st in stats])
|
|
239
244
|
out = np.empty(len(rows))
|
|
240
245
|
for i, r in enumerate(rows):
|
|
241
246
|
vals = floats(r if isinstance(r, (list, tuple, np.ndarray)) else [r], f"{name}[{i}]", lo=0, hi=1)
|
|
@@ -318,10 +323,20 @@ def _unit(x: Any, name: str) -> np.ndarray:
|
|
|
318
323
|
higher_is_better=None,
|
|
319
324
|
)
|
|
320
325
|
def weat_effect_size(
|
|
321
|
-
X: Any,
|
|
326
|
+
X: Any,
|
|
327
|
+
Y: Any,
|
|
328
|
+
A: Any,
|
|
329
|
+
B: Any,
|
|
330
|
+
*,
|
|
331
|
+
n_permutations: int = 10_000,
|
|
332
|
+
random_state: Optional[int] = None,
|
|
333
|
+
resampling: str = "numpy",
|
|
322
334
|
) -> MetricResult:
|
|
323
335
|
"""Embeddings (rows) of the two target sets and two attribute sets. The one-sided p-value uses random
|
|
324
|
-
equal-size re-partitions of X ∪ Y (exact enumeration is used when it is smaller
|
|
336
|
+
equal-size re-partitions of X ∪ Y (exact enumeration is used when it is smaller, in the compiled core when
|
|
337
|
+
available, with identical results). ``resampling="native"`` (opt-in) draws the random re-partitions in the
|
|
338
|
+
compiled core, in parallel: reproducible with ``random_state`` but a different random stream from the
|
|
339
|
+
default NumPy one, so the p-value differs slightly."""
|
|
325
340
|
x, y, a, b = (_unit(v, n) for v, n in ((X, "X"), (Y, "Y"), (A, "A"), (B, "B")))
|
|
326
341
|
dims = {m.shape[1] for m in (x, y, a, b)}
|
|
327
342
|
if len(dims) != 1:
|
|
@@ -337,13 +352,27 @@ def weat_effect_size(
|
|
|
337
352
|
rng = np.random.default_rng(random_state)
|
|
338
353
|
n, nx = s.size, len(x)
|
|
339
354
|
total = s.sum()
|
|
340
|
-
if
|
|
355
|
+
if resampling not in ("numpy", "native"):
|
|
356
|
+
raise InputValidationError("resampling must be 'numpy' or 'native'.")
|
|
357
|
+
c = core
|
|
358
|
+
if resampling == "native" and c is None:
|
|
359
|
+
raise InputValidationError("resampling='native' needs the compiled core, which is not available.")
|
|
360
|
+
threshold = float(stat - 1e-12)
|
|
361
|
+
exact = math.comb(n, nx) <= n_permutations
|
|
362
|
+
if c is not None and (exact or resampling == "native"):
|
|
363
|
+
# Exact enumeration is bit-identical to the loop below; random splits only on opt-in.
|
|
364
|
+
trials = None if exact else int(n_permutations)
|
|
365
|
+
seed = 0 if exact else int(rng.integers(0, 2**63))
|
|
366
|
+
hits = c.split_permutation_count(s.tolist(), nx, float(total), threshold, trials, seed)
|
|
367
|
+
p = hits / (math.comb(n, nx) if exact else int(n_permutations))
|
|
368
|
+
elif exact:
|
|
341
369
|
from itertools import combinations
|
|
342
370
|
|
|
343
|
-
stats_ = np.array([2 * s[list(
|
|
371
|
+
stats_ = np.array([2 * s[list(c_)].sum() - total for c_ in combinations(range(n), nx)])
|
|
372
|
+
p = float((stats_ >= threshold).mean())
|
|
344
373
|
else:
|
|
345
374
|
stats_ = np.array([2 * s[rng.permutation(n)[:nx]].sum() - total for _ in range(n_permutations)])
|
|
346
|
-
|
|
375
|
+
p = float((stats_ >= threshold).mean())
|
|
347
376
|
return MetricResult(
|
|
348
377
|
"weat_effect_size", "WEAT effect size", float(d), {"p_value": p, "test_statistic": float(stat)}
|
|
349
378
|
)
|
|
@@ -442,6 +471,20 @@ def pii_leakage_rate(
|
|
|
442
471
|
return rate("pii_leakage_rate", "PII leakage rate", flags, extra)
|
|
443
472
|
|
|
444
473
|
|
|
474
|
+
def _native_better(canaries: np.ndarray, rows: list[Any]) -> Optional[list[int]]:
|
|
475
|
+
"""Per canary, the number of its candidates scored strictly below it, from the compiled core (which reads the
|
|
476
|
+
rows directly); None (use the Python path, with its validation messages) without the core, for rows that are
|
|
477
|
+
not sequences of numbers, or for NaN or infinite values."""
|
|
478
|
+
c = core
|
|
479
|
+
if c is None:
|
|
480
|
+
return None
|
|
481
|
+
try:
|
|
482
|
+
out: Optional[list[int]] = c.count_below(rows, canaries.tolist())
|
|
483
|
+
except (TypeError, ValueError, OverflowError):
|
|
484
|
+
return None
|
|
485
|
+
return out
|
|
486
|
+
|
|
487
|
+
|
|
445
488
|
@register(
|
|
446
489
|
category=_C,
|
|
447
490
|
task="privacy",
|
|
@@ -464,15 +507,21 @@ def exposure(canary_scores: Any, candidate_scores: Any, *, space_size: Optional[
|
|
|
464
507
|
rows = lists_of(candidate_scores, "candidate_scores")
|
|
465
508
|
same_length(("canary_scores", c), ("candidate_scores", rows))
|
|
466
509
|
per = np.empty(c.size)
|
|
510
|
+
counts = _native_better(c, rows)
|
|
467
511
|
for i, (canary, cand) in enumerate(zip(c, rows)):
|
|
468
|
-
|
|
469
|
-
|
|
512
|
+
if counts is None:
|
|
513
|
+
r = floats(cand, f"candidate_scores[{i}]")
|
|
514
|
+
better, m = int((r < canary).sum()), int(r.size)
|
|
515
|
+
else:
|
|
516
|
+
better, m = counts[i], len(cand)
|
|
517
|
+
if not m:
|
|
518
|
+
raise InputValidationError(f"candidate_scores[{i}] is empty. Provide at least one example.")
|
|
470
519
|
if space_size is None:
|
|
471
|
-
size, rank = float(
|
|
520
|
+
size, rank = float(m + 1), float(better + 1)
|
|
472
521
|
else:
|
|
473
|
-
if space_size <
|
|
522
|
+
if space_size < m + 1:
|
|
474
523
|
raise InputValidationError("space_size must be at least the number of candidates + 1.")
|
|
475
|
-
size, rank = space_size, max(1.0, better /
|
|
524
|
+
size, rank = space_size, max(1.0, better / m * space_size + 1)
|
|
476
525
|
per[i] = math.log2(size) - math.log2(rank)
|
|
477
526
|
return MetricResult(
|
|
478
527
|
"exposure",
|
evalsuite/stats/_resolve.py
CHANGED
|
@@ -11,7 +11,7 @@ import numpy as np
|
|
|
11
11
|
from numpy.typing import NDArray
|
|
12
12
|
|
|
13
13
|
from .._native import array_view, core
|
|
14
|
-
from ..core.exceptions import InputValidationError, StatisticalTestError
|
|
14
|
+
from ..core.exceptions import EvalSuiteError, InputValidationError, StatisticalTestError
|
|
15
15
|
from ..core.validation import target_type, to_numpy
|
|
16
16
|
|
|
17
17
|
MetricFn = Callable[..., Any]
|
|
@@ -203,6 +203,78 @@ class MetricCall:
|
|
|
203
203
|
counts: NDArray[np.uint64] = np.frombuffer(raw, dtype=np.uint64).reshape(indices.shape[0], kk)
|
|
204
204
|
return counts
|
|
205
205
|
|
|
206
|
+
def _curve_inputs(self) -> Optional[tuple[Any, ...]]:
|
|
207
|
+
"""(core, target, score, weights or None) when this call is binary ROC AUC / average precision with class
|
|
208
|
+
labels fixed across subsets (so a subset's 0/1 target is the full target at its indices), else None."""
|
|
209
|
+
from ..classification.metrics import _binary_target, _ctx, average_precision, roc_auc
|
|
210
|
+
|
|
211
|
+
c = core
|
|
212
|
+
if c is None or self.items or self.fn not in (roc_auc, average_precision):
|
|
213
|
+
return None
|
|
214
|
+
kw = self.kwargs
|
|
215
|
+
if "labels" not in kw or set(kw) - {"labels", "pos_label", "average", "multi_class"}:
|
|
216
|
+
return None
|
|
217
|
+
if kw.get("multi_class", "ovr") != "ovr" or kw.get("average", "auto") not in ("auto", "macro", "binary"):
|
|
218
|
+
return None
|
|
219
|
+
try:
|
|
220
|
+
ctx = _ctx(self.y_true, None, y_prob=self.second, labels=kw["labels"], sample_weight=self.weight)
|
|
221
|
+
if ctx.target_type != "binary":
|
|
222
|
+
return None
|
|
223
|
+
target = _binary_target(ctx, kw.get("pos_label"))
|
|
224
|
+
except EvalSuiteError:
|
|
225
|
+
return None
|
|
226
|
+
score = np.ascontiguousarray(ctx.y_prob, dtype=np.float64)
|
|
227
|
+
w = None if self.weight is None else np.ascontiguousarray(ctx.weights, dtype=np.float64)
|
|
228
|
+
return c, np.ascontiguousarray(target, dtype=np.float64), score, w
|
|
229
|
+
|
|
230
|
+
def _curve_values(self, stats: list[tuple[float, float, float, float]]) -> NDArray[np.float64]:
|
|
231
|
+
from ..classification.metrics import roc_auc
|
|
232
|
+
|
|
233
|
+
out = np.empty(len(stats))
|
|
234
|
+
for b, (auc, ap, tp, fp) in enumerate(stats):
|
|
235
|
+
if self.fn is roc_auc:
|
|
236
|
+
out[b] = auc if tp != 0 and fp != 0 else np.nan
|
|
237
|
+
else:
|
|
238
|
+
out[b] = ap if tp != 0 else np.nan
|
|
239
|
+
return out
|
|
240
|
+
|
|
241
|
+
def batch_curves(self, indices: NDArray[np.int64]) -> Optional[NDArray[np.float64]]:
|
|
242
|
+
"""Binary ROC AUC or average precision on every resample at once (compiled core, resamples in parallel),
|
|
243
|
+
NaN where undefined; None when not applicable (the caller evaluates resamples one by one). Bit-identical
|
|
244
|
+
to calling the metric on each resample."""
|
|
245
|
+
inputs = self._curve_inputs() if indices.ndim == 2 and indices.shape[0] else None
|
|
246
|
+
if inputs is None:
|
|
247
|
+
return None
|
|
248
|
+
c, target, score, w = inputs
|
|
249
|
+
idx, idx_v = array_view(indices, np.int64)
|
|
250
|
+
stats = c.bootstrap_curves(
|
|
251
|
+
array_view(target, np.float64)[1],
|
|
252
|
+
array_view(score, np.float64)[1],
|
|
253
|
+
None if w is None else array_view(w, np.float64)[1],
|
|
254
|
+
idx_v,
|
|
255
|
+
idx.shape[0],
|
|
256
|
+
)
|
|
257
|
+
return self._curve_values(stats)
|
|
258
|
+
|
|
259
|
+
def leave_out_curves(self, blocks: list[NDArray[Any]]) -> Optional[NDArray[np.float64]]:
|
|
260
|
+
"""The metric without each block (jackknife), all blocks at once in the compiled core; None if not
|
|
261
|
+
applicable. Bit-identical to calling the metric on the kept observations."""
|
|
262
|
+
inputs = self._curve_inputs() if blocks else None
|
|
263
|
+
if inputs is None:
|
|
264
|
+
return None
|
|
265
|
+
c, target, score, w = inputs
|
|
266
|
+
group_of = np.empty(self.n, dtype=np.uint32)
|
|
267
|
+
for g, block in enumerate(blocks):
|
|
268
|
+
group_of[block] = g
|
|
269
|
+
stats = c.leave_group_out_curves(
|
|
270
|
+
array_view(target, np.float64)[1],
|
|
271
|
+
array_view(score, np.float64)[1],
|
|
272
|
+
None if w is None else array_view(w, np.float64)[1],
|
|
273
|
+
array_view(group_of, np.uint32)[1],
|
|
274
|
+
len(blocks),
|
|
275
|
+
)
|
|
276
|
+
return self._curve_values(stats)
|
|
277
|
+
|
|
206
278
|
def from_counts(self, counts: NDArray[Any], idx: Optional[NDArray[np.int64]] = None) -> float:
|
|
207
279
|
"""The metric on observations summarised by ``counts`` (equal to calling it on them directly)."""
|
|
208
280
|
if self._labels is None: # pragma: no cover - guarded by callers
|
evalsuite/stats/intervals.py
CHANGED
|
@@ -101,6 +101,10 @@ def resample_indices(
|
|
|
101
101
|
|
|
102
102
|
def bootstrap_distribution(call: MetricCall, indices: NDArray[np.int64]) -> tuple[NDArray[np.float64], int]:
|
|
103
103
|
"""Metric value on each resample; resamples where the metric is undefined become NaN."""
|
|
104
|
+
# Binary ROC AUC / average precision: every resample's curve in one parallel compiled call.
|
|
105
|
+
curves = call.batch_curves(indices)
|
|
106
|
+
if curves is not None:
|
|
107
|
+
return curves, int(np.isnan(curves).sum())
|
|
104
108
|
values = np.empty(indices.shape[0])
|
|
105
109
|
failed = 0
|
|
106
110
|
# Confusion-matrix metrics: count every resample's (true, predicted) pairs in one compiled pass.
|
|
@@ -119,6 +123,9 @@ def bootstrap_distribution(call: MetricCall, indices: NDArray[np.int64]) -> tupl
|
|
|
119
123
|
def _jackknife(call: MetricCall, n: int, rng: np.random.Generator, groups: int) -> NDArray[np.float64]:
|
|
120
124
|
"""Leave-one-out (or leave-one-group-out for large n) estimates for the BCa acceleration."""
|
|
121
125
|
blocks = [np.array([i]) for i in range(n)] if n <= groups else np.array_split(rng.permutation(n), groups)
|
|
126
|
+
fast = call.leave_out_curves(blocks)
|
|
127
|
+
if fast is not None:
|
|
128
|
+
return fast
|
|
122
129
|
everything = np.arange(n)
|
|
123
130
|
out = np.empty(len(blocks))
|
|
124
131
|
# Confusion-matrix metrics: the counts without a block are the full counts minus the block's.
|
|
@@ -317,9 +324,19 @@ def delong_placements(
|
|
|
317
324
|
from ..core.exceptions import MetricInputError
|
|
318
325
|
|
|
319
326
|
raise MetricInputError("DeLong's method needs at least one positive and one negative observation.")
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
327
|
+
c = core
|
|
328
|
+
if c is not None:
|
|
329
|
+
# One compiled sort per column gives all three rankings (exact half-integer mid-ranks).
|
|
330
|
+
keep = np.ascontiguousarray(y == 1)
|
|
331
|
+
cols = [np.ascontiguousarray(row, dtype=np.float64) for row in scores]
|
|
332
|
+
out = c.delong_ranks(array_view(keep, np.bool_)[1], [array_view(col, np.float64)[1] for col in cols])
|
|
333
|
+
as_rows = [np.vstack([np.frombuffer(r[j], dtype=np.float64) for r in out]) for j in range(4)]
|
|
334
|
+
tz = np.concatenate([as_rows[0], as_rows[1]], axis=1)
|
|
335
|
+
tx, ty = as_rows[2], as_rows[3]
|
|
336
|
+
else:
|
|
337
|
+
tx = np.apply_along_axis(stats.rankdata, 1, pos)
|
|
338
|
+
ty = np.apply_along_axis(stats.rankdata, 1, neg)
|
|
339
|
+
tz = np.apply_along_axis(stats.rankdata, 1, np.concatenate([pos, neg], axis=1))
|
|
323
340
|
auc = (tz[:, :m].sum(axis=1) - m * (m + 1) / 2) / (m * n)
|
|
324
341
|
v10 = (tz[:, :m] - tx) / n
|
|
325
342
|
v01 = 1.0 - (tz[:, m:] - ty) / m
|
evalsuite/text/factuality.py
CHANGED
|
@@ -18,6 +18,7 @@ import numpy as np
|
|
|
18
18
|
from ..core.exceptions import InputValidationError
|
|
19
19
|
from ..core.registry import register
|
|
20
20
|
from ..core.result import MetricResult
|
|
21
|
+
from ..llmsys._common import ragged_numbers
|
|
21
22
|
from ._common import per_item
|
|
22
23
|
|
|
23
24
|
__all__ = [
|
|
@@ -190,7 +191,15 @@ def groundedness(support_scores: Any, *, average: Optional[str] = "macro") -> Me
|
|
|
190
191
|
if not answers:
|
|
191
192
|
raise InputValidationError("support_scores must be a non-empty list of score lists (one per answer).")
|
|
192
193
|
sums, counts = [], []
|
|
193
|
-
|
|
194
|
+
native = ragged_numbers(answers)
|
|
195
|
+
if native is not None:
|
|
196
|
+
for i, ((total, lo, hi, _), a) in enumerate(zip(native, answers)):
|
|
197
|
+
m = len(a)
|
|
198
|
+
if m and (lo < 0 or hi > 1):
|
|
199
|
+
raise InputValidationError(f"support_scores[{i}] must be finite values in [0, 1].")
|
|
200
|
+
sums.append(float(total))
|
|
201
|
+
counts.append(m)
|
|
202
|
+
for i, a in enumerate(answers if native is None else ()):
|
|
194
203
|
arr = np.asarray(list(a), dtype=float)
|
|
195
204
|
if arr.size and (not np.all(np.isfinite(arr)) or arr.min() < 0 or arr.max() > 1):
|
|
196
205
|
raise InputValidationError(f"support_scores[{i}] must be finite values in [0, 1].")
|
evalsuite/text/judge.py
CHANGED
|
@@ -20,6 +20,7 @@ else:
|
|
|
20
20
|
|
|
21
21
|
stats = lazy_module("scipy.stats")
|
|
22
22
|
|
|
23
|
+
from .._native import core
|
|
23
24
|
from ..core.exceptions import InputValidationError
|
|
24
25
|
from ..core.registry import register
|
|
25
26
|
from ..core.result import MetricResult
|
|
@@ -158,10 +159,14 @@ def bradley_terry(
|
|
|
158
159
|
or lose every comparison, otherwise the MLE does not exist."""
|
|
159
160
|
names, rows = _comparisons(comparisons)
|
|
160
161
|
m = len(names)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
wins
|
|
164
|
-
|
|
162
|
+
c = core
|
|
163
|
+
if c is not None:
|
|
164
|
+
wins = np.array(c.win_matrix(rows, m)).reshape(m, m)
|
|
165
|
+
else:
|
|
166
|
+
wins = np.zeros((m, m))
|
|
167
|
+
for a, b, o in rows:
|
|
168
|
+
wins[a, b] += o
|
|
169
|
+
wins[b, a] += 1 - o
|
|
165
170
|
games = wins + wins.T
|
|
166
171
|
total_w = wins.sum(axis=1)
|
|
167
172
|
if np.any(total_w == 0) or np.any(total_w == games.sum(axis=1)):
|
|
@@ -225,11 +230,15 @@ def elo_ratings(
|
|
|
225
230
|
names, rows = _comparisons(comparisons)
|
|
226
231
|
if k <= 0 or scale <= 0 or base <= 1:
|
|
227
232
|
raise InputValidationError("k and scale must be positive and base > 1.")
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
r
|
|
233
|
+
c = core
|
|
234
|
+
if c is not None:
|
|
235
|
+
r = np.array(c.elo_ratings(rows, len(names), float(k), float(initial), float(scale), float(base)))
|
|
236
|
+
else:
|
|
237
|
+
r = np.full(len(names), float(initial))
|
|
238
|
+
for a, b, o in rows:
|
|
239
|
+
ea = 1 / (1 + base ** ((r[b] - r[a]) / scale))
|
|
240
|
+
r[a] += k * (o - ea)
|
|
241
|
+
r[b] += k * ((1 - o) - (1 - ea))
|
|
233
242
|
return MetricResult(
|
|
234
243
|
"elo_ratings",
|
|
235
244
|
"Elo rating",
|
evalsuite/text/qa.py
CHANGED
|
@@ -9,6 +9,7 @@ from typing import Any, Optional
|
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
|
|
12
|
+
from .._native import core
|
|
12
13
|
from ..core.exceptions import InputValidationError
|
|
13
14
|
from ..core.registry import register
|
|
14
15
|
from ..core.result import MetricResult
|
|
@@ -25,6 +26,14 @@ _ARTICLES = re.compile(r"\b(a|an|the)\b", re.UNICODE)
|
|
|
25
26
|
_PUNCT = set(string.punctuation)
|
|
26
27
|
|
|
27
28
|
|
|
29
|
+
def normalize_answers(texts: list[str]) -> list[str]:
|
|
30
|
+
"""``normalize_answer`` of each text: ASCII texts in the compiled core (one call), others in Python."""
|
|
31
|
+
c = core
|
|
32
|
+
if c is None:
|
|
33
|
+
return [normalize_answer(t) for t in texts]
|
|
34
|
+
return [n if n is not None else normalize_answer(t) for n, t in zip(c.squad_normalize(texts), texts)]
|
|
35
|
+
|
|
36
|
+
|
|
28
37
|
def normalize_answer(text: str) -> str:
|
|
29
38
|
"""SQuAD normalization: lowercase, drop punctuation and the articles a/an/the, collapse whitespace."""
|
|
30
39
|
text = text.lower()
|
|
@@ -55,6 +64,16 @@ def _f1(pred: str, ref: str) -> float:
|
|
|
55
64
|
return 2 * precision * recall / (precision + recall)
|
|
56
65
|
|
|
57
66
|
|
|
67
|
+
def _native_scores(preds: list[str], refs: list[list[str]], normalize: Any, f1: bool) -> Optional[list[float]]:
|
|
68
|
+
"""Exact match / token F1 per example from the compiled core, for SQuAD (``True``) or no normalisation on
|
|
69
|
+
ASCII text; None (use Python) without the core, for a custom normaliser or for non-ASCII text."""
|
|
70
|
+
c = core
|
|
71
|
+
if c is None or not (normalize is True or normalize is False or normalize is None):
|
|
72
|
+
return None
|
|
73
|
+
out: Optional[list[float]] = c.qa_scores(preds, refs, normalize is True, f1)
|
|
74
|
+
return out
|
|
75
|
+
|
|
76
|
+
|
|
58
77
|
def _finish(metric: str, name: str, scores: list[float], average: Optional[str], normalize: Any) -> MetricResult:
|
|
59
78
|
arr = np.array(scores, dtype=float)
|
|
60
79
|
value: Any = arr if average is None else float(arr.mean())
|
|
@@ -81,7 +100,9 @@ def exact_match(
|
|
|
81
100
|
preds = as_texts(predictions, "predictions")
|
|
82
101
|
refs = as_references(references, len(preds))
|
|
83
102
|
f = _norm(normalize)
|
|
84
|
-
scores =
|
|
103
|
+
scores = _native_scores(preds, refs, normalize, f1=False)
|
|
104
|
+
if scores is None:
|
|
105
|
+
scores = [float(any(f(p) == f(r) for r in rs)) for p, rs in zip(preds, refs)]
|
|
85
106
|
return _finish("exact_match", "Exact match", scores, average, normalize)
|
|
86
107
|
|
|
87
108
|
|
|
@@ -104,5 +125,7 @@ def token_f1(
|
|
|
104
125
|
preds = as_texts(predictions, "predictions")
|
|
105
126
|
refs = as_references(references, len(preds))
|
|
106
127
|
f = _norm(normalize)
|
|
107
|
-
scores =
|
|
128
|
+
scores = _native_scores(preds, refs, normalize, f1=True)
|
|
129
|
+
if scores is None:
|
|
130
|
+
scores = [max(_f1(f(p), f(r)) for r in rs) for p, rs in zip(preds, refs)]
|
|
108
131
|
return _finish("token_f1", "Token F1", scores, average, normalize)
|
evalsuite/text/reasoning.py
CHANGED
|
@@ -8,11 +8,12 @@ from typing import Any, Optional
|
|
|
8
8
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
|
|
11
|
+
from .._native import Vocab, core
|
|
11
12
|
from ..core.exceptions import InputValidationError
|
|
12
13
|
from ..core.registry import register
|
|
13
14
|
from ..core.result import MetricResult
|
|
14
15
|
from ._common import _seq, as_references, check_positive_int, per_item
|
|
15
|
-
from .qa import _norm
|
|
16
|
+
from .qa import _norm, normalize_answers
|
|
16
17
|
|
|
17
18
|
__all__ = ["benchmark_accuracy", "extract_answer", "majority_vote_accuracy", "pass_at_k"]
|
|
18
19
|
|
|
@@ -85,12 +86,39 @@ def majority_vote_accuracy(
|
|
|
85
86
|
refs = as_references(references, len(groups))
|
|
86
87
|
f = _norm(normalize)
|
|
87
88
|
scores = []
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
c = core
|
|
90
|
+
if c is not None:
|
|
91
|
+
for i, answers in enumerate(groups):
|
|
92
|
+
if isinstance(answers, str) or not answers:
|
|
93
|
+
raise InputValidationError(f"samples[{i}] must be a non-empty list of answer strings.")
|
|
94
|
+
if normalize is True:
|
|
95
|
+
# SQuAD normalisation of every answer and reference in one compiled call.
|
|
96
|
+
flat = normalize_answers([str(a) for answers in groups for a in answers])
|
|
97
|
+
normed, pos = [], 0
|
|
98
|
+
for answers in groups:
|
|
99
|
+
normed.append(flat[pos : pos + len(answers)])
|
|
100
|
+
pos += len(answers)
|
|
101
|
+
ref_norm = normalize_answers([r for rs in refs for r in rs])
|
|
102
|
+
nrefs, pos = [], 0
|
|
103
|
+
for rs in refs:
|
|
104
|
+
nrefs.append(ref_norm[pos : pos + len(rs)])
|
|
105
|
+
pos += len(rs)
|
|
106
|
+
else:
|
|
107
|
+
normed = [[f(str(a)) for a in answers] for answers in groups]
|
|
108
|
+
nrefs = [[f(r) for r in rs] for rs in refs]
|
|
109
|
+
v = Vocab()
|
|
110
|
+
stats = c.group_stats([v.encode(g) for g in normed])
|
|
111
|
+
table = list(v.ids)
|
|
112
|
+
for st, rs in zip(stats, nrefs):
|
|
113
|
+
top = table[st[4]] # the modal answer, first seen among ties, as Counter.most_common
|
|
114
|
+
scores.append(float(any(top == r for r in rs)))
|
|
115
|
+
else:
|
|
116
|
+
for i, (answers, rs) in enumerate(zip(groups, refs)):
|
|
117
|
+
if isinstance(answers, str) or not answers:
|
|
118
|
+
raise InputValidationError(f"samples[{i}] must be a non-empty list of answer strings.")
|
|
119
|
+
votes = Counter(f(str(a)) for a in answers)
|
|
120
|
+
top = votes.most_common(1)[0][0] # Counter keeps first-seen order among ties
|
|
121
|
+
scores.append(float(any(top == f(r) for r in rs)))
|
|
94
122
|
arr = np.array(scores)
|
|
95
123
|
value: Any = arr if average is None else float(arr.mean())
|
|
96
124
|
return MetricResult("majority_vote_accuracy", "Majority-vote accuracy", value, {"n_questions": len(scores)})
|
evalsuite/version.py
CHANGED
evalsuite/vision/segmentation.py
CHANGED
|
@@ -36,6 +36,7 @@ else:
|
|
|
36
36
|
|
|
37
37
|
ndimage = lazy_module("scipy.ndimage")
|
|
38
38
|
|
|
39
|
+
from .._native import array_view, core
|
|
39
40
|
from ..core.exceptions import InputValidationError, UndefinedMetricWarning
|
|
40
41
|
from ..core.export import PathLike, csv_text, html_document, html_table, save_as
|
|
41
42
|
from ..core.registry import register
|
|
@@ -559,6 +560,21 @@ def _surface_distances(
|
|
|
559
560
|
return np.asarray(d_ab, dtype=np.float64), np.asarray(d_ba, dtype=np.float64)
|
|
560
561
|
|
|
561
562
|
|
|
563
|
+
def _native_surface_distances(
|
|
564
|
+
a: NDArray[np.bool_], b: NDArray[np.bool_], spacing: Optional[Sequence[float]]
|
|
565
|
+
) -> tuple[NDArray[np.float64], NDArray[np.float64]]:
|
|
566
|
+
"""Surface distances of two non-empty masks: the compiled core for 2-D and 3-D masks (surfaces and an
|
|
567
|
+
exact grid nearest-point search, same arithmetic as the direct comparison), Python otherwise."""
|
|
568
|
+
c = core
|
|
569
|
+
if c is None or a.ndim not in (2, 3):
|
|
570
|
+
return _surface_distances(_surface(a), _surface(b), spacing)
|
|
571
|
+
sp = [1.0] * a.ndim if spacing is None else [float(x) for x in spacing]
|
|
572
|
+
_a, va = array_view(a, np.bool_)
|
|
573
|
+
_b, vb = array_view(b, np.bool_)
|
|
574
|
+
da, db = c.surface_distances(va, vb, list(a.shape), sp)
|
|
575
|
+
return np.frombuffer(da, dtype=np.float64), np.frombuffer(db, dtype=np.float64)
|
|
576
|
+
|
|
577
|
+
|
|
562
578
|
def _check_spacing(spacing: Optional[Sequence[float]], ndim: int) -> Optional[tuple[float, ...]]:
|
|
563
579
|
if spacing is None:
|
|
564
580
|
return None
|
|
@@ -604,7 +620,7 @@ def _surface_metric(
|
|
|
604
620
|
values[i, j] = math.inf
|
|
605
621
|
one_empty += 1
|
|
606
622
|
continue
|
|
607
|
-
d_ab, d_ba =
|
|
623
|
+
d_ab, d_ba = _native_surface_distances(ta, pb, sp)
|
|
608
624
|
if which == "hd":
|
|
609
625
|
if percentile == 100:
|
|
610
626
|
values[i, j] = max(float(np.max(d_ab)), float(np.max(d_ba)))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: evalsuite-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
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,11 +85,13 @@ 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.
|
|
88
|
+
> **Status: stable (0.7.1).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
|
|
89
89
|
> **0.6 adds a compiled Rust core**: same API and identical results, with text metrics, COCO evaluation and
|
|
90
90
|
> bootstrap resampling several times faster and multithreaded (prebuilt wheels for Linux, macOS and Windows).
|
|
91
|
-
> 0.
|
|
92
|
-
>
|
|
91
|
+
> **0.7.0** moves ROC AUC / average precision (and so `evaluate()`), the LLM-systems consistency metrics,
|
|
92
|
+
> groundedness, citation coverage, toxicity, exposure and Elo into the core.
|
|
93
|
+
> **0.7.1** adds bootstrapped ROC AUC / AP (4–5× faster intervals), DeLong, QA exact match / F1,
|
|
94
|
+
> Hausdorff / surface distances, calibration and the WEAT permutation test.
|
|
93
95
|
> **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
|
|
94
96
|
> multilingual, code generation, long context and summarization, and inference efficiency and cost.
|
|
95
97
|
|
|
@@ -113,10 +115,10 @@ is needed. Anywhere else pip falls back to a pure-Python wheel that gives exactl
|
|
|
113
115
|
|
|
114
116
|
The core runs independent examples (sentences, images, classes, resamples) in parallel on all CPU cores; set
|
|
115
117
|
`EVALSUITE_NUM_THREADS` to cap the number of threads. Results never depend on the thread count: sums are always
|
|
116
|
-
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`)
|
|
117
|
-
`resampling="native"` to draw
|
|
118
|
-
`random_state` and faster on large inputs, but a different random stream from
|
|
119
|
-
interval endpoints differ slightly (statistically equivalent).
|
|
118
|
+
taken in example order. Bootstrap functions (`bootstrap_ci`, `paired_bootstrap_test`, `compare`) and
|
|
119
|
+
`weat_effect_size` accept `resampling="native"` to draw resamples (or permutations) in the core (seeded
|
|
120
|
+
xoshiro256++): reproducible with `random_state` and faster on large inputs, but a different random stream from
|
|
121
|
+
the default NumPy one, so interval endpoints and p-values differ slightly (statistically equivalent).
|
|
120
122
|
|
|
121
123
|
## Why EvalSuite
|
|
122
124
|
|
|
@@ -358,53 +360,57 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
|
|
|
358
360
|
|
|
359
361
|
## Performance
|
|
360
362
|
|
|
361
|
-
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.
|
|
363
|
+
Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.7.1, Python 3.13,
|
|
362
364
|
NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
|
|
363
|
-
difference 2.5e-14),
|
|
364
|
-
0.89
|
|
365
|
-
27 cases and three sizes is **4.
|
|
365
|
+
difference 2.5e-14), 80 are faster (the other, the maintainability index, runs Python's own `ast` parser
|
|
366
|
+
like radon and lands at 0.89× on this run), and the geometric-mean speed-up across all
|
|
367
|
+
27 cases and three sizes is **4.30×**. At 1,000,000 samples (pixels for
|
|
366
368
|
segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
|
|
367
369
|
alphabetical order:
|
|
368
370
|
|
|
369
371
|
| Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
|
|
370
372
|
| --- | --- | ---: | ---: | ---: |
|
|
371
|
-
| 10 classes: macro F1 | scikit-learn |
|
|
372
|
-
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.
|
|
373
|
-
| binary: 8 label metrics via evaluate() | scikit-learn |
|
|
374
|
-
| binary: ROC AUC | scikit-learn |
|
|
375
|
-
| calibration: slope and intercept | statsmodels |
|
|
376
|
-
| clinical: diagnostic report (7 CIs) | statsmodels |
|
|
377
|
-
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn |
|
|
378
|
-
| decision curve: 99 thresholds | NumPy loop |
|
|
379
|
-
| detection: COCO evaluation (1000 images) | pycocotools |
|
|
380
|
-
| multiple testing: Hochberg (n p-values) | statsmodels |
|
|
381
|
-
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn |
|
|
382
|
-
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx |
|
|
383
|
-
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn |
|
|
384
|
-
| segmentation: Hausdorff distance (50 images) | SciPy |
|
|
385
|
-
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.
|
|
386
|
-
| statistics: Mann–Whitney U | SciPy |
|
|
387
|
-
| statistics: Welch t-test | SciPy |
|
|
388
|
-
| structured: JSON Schema compliance (10000 documents) | jsonschema |
|
|
389
|
-
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu |
|
|
390
|
-
| systems: confidence AUROC (n answers) | scikit-learn |
|
|
391
|
-
| systems: distribution-shift drop, Welch CI (n scores) | SciPy |
|
|
392
|
-
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema |
|
|
393
|
-
| systems: latency p50 / p95 / p99 (n requests) | NumPy |
|
|
394
|
-
| systems: maintainability index (1000 programs) | radon |
|
|
395
|
-
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU |
|
|
396
|
-
| text: METEOR, exact and stem matches (10000 sentences) | NLTK |
|
|
397
|
-
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score |
|
|
373
|
+
| 10 classes: macro F1 | scikit-learn | 9.2 | 106.2 | **11.5×** |
|
|
374
|
+
| agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 1.7 | 3.6 | **2.1×** |
|
|
375
|
+
| binary: 8 label metrics via evaluate() | scikit-learn | 10.0 | 932.8 | **93.4×** |
|
|
376
|
+
| binary: ROC AUC | scikit-learn | 86.2 | 305.1 | **3.5×** |
|
|
377
|
+
| calibration: slope and intercept | statsmodels | 209.6 | 1146.2 | **5.5×** |
|
|
378
|
+
| clinical: diagnostic report (7 CIs) | statsmodels | 5.2 | 5.9 | **1.1×** |
|
|
379
|
+
| clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 20.9 | 381.9 | **18.3×** |
|
|
380
|
+
| decision curve: 99 thresholds | NumPy loop | 145.7 | 190.2 | **1.3×** |
|
|
381
|
+
| detection: COCO evaluation (1000 images) | pycocotools | 37.2 | 731.1 | **19.7×** |
|
|
382
|
+
| multiple testing: Hochberg (n p-values) | statsmodels | 74.3 | 79.7 | **1.1×** |
|
|
383
|
+
| regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 7.9 | 13.4 | **1.7×** |
|
|
384
|
+
| retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 156.1 | 583.6 | **3.7×** |
|
|
385
|
+
| segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 36.1 | 248.7 | **6.9×** |
|
|
386
|
+
| segmentation: Hausdorff distance (50 images) | SciPy | 4.6 | 16.6 | **3.6×** |
|
|
387
|
+
| statistics: Cramér's V (5×5 table) | SciPy | 0.0 | 0.2 | **12.4×** |
|
|
388
|
+
| statistics: Mann–Whitney U | SciPy | 135.5 | 303.6 | **2.2×** |
|
|
389
|
+
| statistics: Welch t-test | SciPy | 7.1 | 10.4 | **1.5×** |
|
|
390
|
+
| structured: JSON Schema compliance (10000 documents) | jsonschema | 103.6 | 211.7 | **2.0×** |
|
|
391
|
+
| systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 334.9 | 592.4 | **1.8×** |
|
|
392
|
+
| systems: confidence AUROC (n answers) | scikit-learn | 162.4 | 265.7 | **1.6×** |
|
|
393
|
+
| systems: distribution-shift drop, Welch CI (n scores) | SciPy | 8.4 | 9.6 | **1.1×** |
|
|
394
|
+
| systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 108.1 | 252.4 | **2.3×** |
|
|
395
|
+
| systems: latency p50 / p95 / p99 (n requests) | NumPy | 13.2 | 15.0 | **1.1×** |
|
|
396
|
+
| systems: maintainability index (1000 programs) | radon | 100.8 | 89.5 | 0.89× |
|
|
397
|
+
| text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 206.2 | 2405.2 | **11.7×** |
|
|
398
|
+
| text: METEOR, exact and stem matches (10000 sentences) | NLTK | 72.2 | 404.0 | **5.6×** |
|
|
399
|
+
| text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 179.5 | 678.9 | **3.8×** |
|
|
398
400
|
|
|
399
401
|
**Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
|
|
400
402
|
statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
|
|
401
403
|
independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
|
|
402
|
-
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.
|
|
404
|
+
comparisons agree**, and against the libraries the geometric-mean speed-up is **6.64×** (171 of 172
|
|
403
405
|
measurements faster). Per-metric table in BENCHMARKS.md.
|
|
404
406
|
|
|
405
|
-
**
|
|
406
|
-
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation)
|
|
407
|
-
|
|
407
|
+
**Nearly every workload is faster than its reference.** The text metrics (BLEU, chrF, TER, ROUGE, METEOR, CIDEr,
|
|
408
|
+
CodeBLEU's n-gram terms, distinct-n), the whole COCO evaluation (IoU, score sort, matching, accumulation),
|
|
409
|
+
ROC AUC and average precision (one sort per column, shared by both inside `evaluate()`), the LLM-systems
|
|
410
|
+
consistency, groundedness, citation, toxicity and exposure metrics, Elo ratings, bootstrap resampling (including
|
|
411
|
+
whole bootstrap and jackknife runs of ROC AUC / AP), DeLong, QA exact match and F1,
|
|
412
|
+
Hausdorff and surface distances, calibration bins and the WEAT permutation test run in the compiled,
|
|
413
|
+
multithreaded Rust core; bootstrap intervals, paired bootstrap tests and
|
|
408
414
|
`compare()` evaluate confusion-matrix metrics from counts of each resample's (true, predicted) pairs instead of
|
|
409
415
|
copies of the data. `evaluate()` validates inputs once and builds the confusion
|
|
410
416
|
matrix once for all metrics, and integer labels are encoded without sorting. The rank tests rank the data once
|
|
@@ -9,10 +9,10 @@ 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=d1HZCQ8GO5P3YKtfaBakMXo_4NZVAzNBud45TM3pyFA,98
|
|
13
13
|
evalsuite/classification/__init__.py,sha256=ErBIXbBGnhfW6v-1Cn5SegiERoyxNlmO1tEKcLM15mA,833
|
|
14
14
|
evalsuite/classification/_common.py,sha256=3ANV33ix_mnOzvOAG8glyJO-iYVhhTGO0S3YG0ZddB8,4543
|
|
15
|
-
evalsuite/classification/metrics.py,sha256=
|
|
15
|
+
evalsuite/classification/metrics.py,sha256=cP9TAVVk6Pob2VUuxMfQpOakzVmuMOXzGzqO2oGhED8,40575
|
|
16
16
|
evalsuite/cli/__init__.py,sha256=1x48hORLcg_Is2X08A7CPBT6VDJ1QL94zaJP1HTFxUY,96
|
|
17
17
|
evalsuite/cli/main.py,sha256=ktvy_5D-KfYevKH5ZxO5f0aVFtNXbGeN8zker0tguT0,23994
|
|
18
18
|
evalsuite/clinical/__init__.py,sha256=xaXLvNvTJsuP525fLb2FyVVNlopIrZczoPrwmEQIvzE,549
|
|
@@ -27,33 +27,33 @@ evalsuite/core/result.py,sha256=L_fQZRGRgVgzII2jZb_jpRBK2jy-CdO5u9s-6pUk9fE,1492
|
|
|
27
27
|
evalsuite/core/types.py,sha256=r6bhUk7CYAcrlQzjmf-6xWQsNqO3EOipZD-e-2yAJTI,720
|
|
28
28
|
evalsuite/core/validation.py,sha256=nZRWSuShdFBDYgXMnRmspSQ4AJPRO3Zy5M8wTFfkg2E,10988
|
|
29
29
|
evalsuite/llmsys/__init__.py,sha256=NA-kVMc3hdmBSW-ufPKrgfd2NHI15wCXJRn3ZhIVFsE,4653
|
|
30
|
-
evalsuite/llmsys/_common.py,sha256=
|
|
31
|
-
evalsuite/llmsys/agents.py,sha256=
|
|
30
|
+
evalsuite/llmsys/_common.py,sha256=d68CyUaO9f8Olp1001Ms2-9tVSwNf96g0D2BlhpvSF0,10271
|
|
31
|
+
evalsuite/llmsys/agents.py,sha256=OYLadZTjuviDV90ZffEDYCRuDyU5rPgpNhiZU894bEk,15574
|
|
32
32
|
evalsuite/llmsys/code.py,sha256=OIyH3aKbuzmH3131wfkj98k5QrrvPwQ1dvCCY4WXD4Y,37528
|
|
33
33
|
evalsuite/llmsys/efficiency.py,sha256=GlUSWNnzRaeuebv-SZYsB28StwIPYb8AIyMwM057g_A,13895
|
|
34
|
-
evalsuite/llmsys/longcontext.py,sha256=
|
|
35
|
-
evalsuite/llmsys/multilingual.py,sha256=
|
|
36
|
-
evalsuite/llmsys/robustness.py,sha256=
|
|
37
|
-
evalsuite/llmsys/safety.py,sha256=
|
|
34
|
+
evalsuite/llmsys/longcontext.py,sha256=WkMO_vT1kp4Hr1Q1IBFwq70C6Jud2e-LURSWZzoAlNY,15870
|
|
35
|
+
evalsuite/llmsys/multilingual.py,sha256=5paFTlIE0eTqBEZWXdhJqwBhklRxHDf92uSfr-z_O60,14524
|
|
36
|
+
evalsuite/llmsys/robustness.py,sha256=Yr1tut2FTodARF-WOLP5jf17GH-zaI0Qy2ZxWmhMhas,20878
|
|
37
|
+
evalsuite/llmsys/safety.py,sha256=_IHkLWw87MPD6xaGzt5UU_1w8ryLw30Us-JJUe17n6Q,24934
|
|
38
38
|
evalsuite/llmsys/uncertainty.py,sha256=Brm_LT8qHb-EtcPe7YBXq7HYMSTG93OkT3Cnx2SYBts,9367
|
|
39
39
|
evalsuite/regression/__init__.py,sha256=t2XEHUw6e5tyWBHcEeiog2WWd-wwaxf4m5AIX8dJyng,571
|
|
40
40
|
evalsuite/regression/metrics.py,sha256=Qv5hFswxfzE-8wOKysERqsEJT-3kvTXPrkLoZ7s9jbQ,23487
|
|
41
41
|
evalsuite/stats/__init__.py,sha256=mtnEqpvlvscQ3C6ceRr8xLKoSHPQWsWB24pEVlvp6fs,1187
|
|
42
|
-
evalsuite/stats/_resolve.py,sha256=
|
|
42
|
+
evalsuite/stats/_resolve.py,sha256=a2Z9rCJ7yNdsIxlCypk94h7Ho-Vewg2ygHahNa7scBU,13829
|
|
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=bVvj_Rj78eb45IZBcI1Iz3gM9kaonvYutRRI1OyIVrQ,17602
|
|
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
|
|
50
50
|
evalsuite/text/_common.py,sha256=acjAoPbXlPtd4DC4YbvOv1frIUjvFa1UtbdA5-6YDsU,3790
|
|
51
|
-
evalsuite/text/factuality.py,sha256=
|
|
51
|
+
evalsuite/text/factuality.py,sha256=RsZu7fl1KU9elB1oBOgms3bnrN4lXVchwqIcl0JDXtc,21212
|
|
52
52
|
evalsuite/text/generation.py,sha256=qrpOvt2T_Fom2M_6YquEEnJbMCr_KwR1kEqtUH6N0tc,52420
|
|
53
|
-
evalsuite/text/judge.py,sha256=
|
|
54
|
-
evalsuite/text/qa.py,sha256=
|
|
53
|
+
evalsuite/text/judge.py,sha256=5DOc-UOUSUPeXwdnjspVEJ-Yhk5659eTQh3jZLVLRfA,23887
|
|
54
|
+
evalsuite/text/qa.py,sha256=ZInaTXzQjxvliu1b2ArcX74OW1UPLXPvYcHGeIgVQH8,5197
|
|
55
55
|
evalsuite/text/rag.py,sha256=GF8GUp6Vnt9peBCIcdvFUapLUL36_NDApZisYG_rcqg,9641
|
|
56
|
-
evalsuite/text/reasoning.py,sha256=
|
|
56
|
+
evalsuite/text/reasoning.py,sha256=Z-c66yq5ADiNHh9ZROIvqh1ACwCJ0c3Q7Q0ciA0OS_0,10254
|
|
57
57
|
evalsuite/text/report.py,sha256=nUAgt24rcQsnPLiNTVn3PlzZO3Y7fW_ch_lSelgfEc8,6241
|
|
58
58
|
evalsuite/text/retrieval.py,sha256=otQvOTbbR79kYtMum6o2HOT9UoDlSj0-JYLsFddkV1k,8969
|
|
59
59
|
evalsuite/text/semantic.py,sha256=TgBBDcRll7vMzQVYStgt1SS9G7e6FTf7SuZDcPL32_g,23004
|
|
@@ -61,10 +61,10 @@ 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
|
-
evalsuite/vision/segmentation.py,sha256=
|
|
65
|
-
evalsuite_python-0.
|
|
66
|
-
evalsuite_python-0.
|
|
67
|
-
evalsuite_python-0.
|
|
68
|
-
evalsuite_python-0.
|
|
69
|
-
evalsuite_python-0.
|
|
70
|
-
evalsuite_python-0.
|
|
64
|
+
evalsuite/vision/segmentation.py,sha256=tYYsBfEYdPvi94k3dJgp8ODn8X0qKsLW5QAv7KuQMj0,41953
|
|
65
|
+
evalsuite_python-0.7.1.dist-info/METADATA,sha256=DXM5m3LNagOakp6M19_-nT2tp3bw-3KPIXU_1FHUk24,29217
|
|
66
|
+
evalsuite_python-0.7.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
67
|
+
evalsuite_python-0.7.1.dist-info/entry_points.txt,sha256=YYIwisn4L4sQt3ntzbM0_Z4yZE2KCu3GJ6KfWL1kIwc,54
|
|
68
|
+
evalsuite_python-0.7.1.dist-info/licenses/LICENSE,sha256=cRRQ6Kk8w2qCqtDSSUJQGy-0rqjmjJG09cZ6iIiMvdc,1095
|
|
69
|
+
evalsuite_python-0.7.1.dist-info/licenses/LICENSE-APACHE,sha256=K4pWYv3dt61u1BuIxjOGBxhgRkpsH4X_dzeIbOILXw0,10784
|
|
70
|
+
evalsuite_python-0.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{evalsuite_python-0.6.1.dist-info → evalsuite_python-0.7.1.dist-info}/licenses/LICENSE-APACHE
RENAMED
|
File without changes
|