evalsuite-python 0.5.2__tar.gz → 0.5.3__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.
Files changed (111) hide show
  1. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/CHANGELOG.md +15 -0
  2. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/PKG-INFO +34 -34
  3. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/README.md +33 -33
  4. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/_common.py +29 -10
  5. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/efficiency.py +3 -4
  6. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/hypothesis.py +22 -9
  7. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/version.py +1 -1
  8. evalsuite_python-0.5.3/tests/stats/test_fast_paths.py +30 -0
  9. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/.gitignore +0 -0
  10. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/CONTRIBUTING.md +0 -0
  11. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/LICENSE +0 -0
  12. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/pyproject.toml +0 -0
  13. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/__init__.py +0 -0
  14. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/__main__.py +0 -0
  15. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/_bench_metrics.py +0 -0
  16. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/_lazy.py +0 -0
  17. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/api.py +0 -0
  18. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/benchmarks.py +0 -0
  19. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/calibration.py +0 -0
  20. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/classification/__init__.py +0 -0
  21. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/classification/_common.py +0 -0
  22. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/classification/metrics.py +0 -0
  23. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/cli/__init__.py +0 -0
  24. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/cli/main.py +0 -0
  25. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/clinical/__init__.py +0 -0
  26. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/clinical/metrics.py +0 -0
  27. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/clinical/report.py +0 -0
  28. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/__init__.py +0 -0
  29. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/context.py +0 -0
  30. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/exceptions.py +0 -0
  31. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/export.py +0 -0
  32. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/registry.py +0 -0
  33. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/result.py +0 -0
  34. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/types.py +0 -0
  35. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/core/validation.py +0 -0
  36. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/__init__.py +0 -0
  37. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/agents.py +0 -0
  38. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/code.py +0 -0
  39. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/longcontext.py +0 -0
  40. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/multilingual.py +0 -0
  41. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/robustness.py +0 -0
  42. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/safety.py +0 -0
  43. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/llmsys/uncertainty.py +0 -0
  44. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/plot.py +0 -0
  45. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/py.typed +0 -0
  46. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/regression/__init__.py +0 -0
  47. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/regression/metrics.py +0 -0
  48. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/reporting.py +0 -0
  49. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/__init__.py +0 -0
  50. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/_resolve.py +0 -0
  51. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/compare.py +0 -0
  52. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/effect.py +0 -0
  53. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/intervals.py +0 -0
  54. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/paired.py +0 -0
  55. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/stats/results.py +0 -0
  56. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/__init__.py +0 -0
  57. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/_common.py +0 -0
  58. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/factuality.py +0 -0
  59. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/generation.py +0 -0
  60. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/judge.py +0 -0
  61. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/qa.py +0 -0
  62. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/rag.py +0 -0
  63. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/reasoning.py +0 -0
  64. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/report.py +0 -0
  65. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/retrieval.py +0 -0
  66. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/semantic.py +0 -0
  67. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/spice.py +0 -0
  68. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/text/structured.py +0 -0
  69. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/vision/__init__.py +0 -0
  70. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/vision/detection.py +0 -0
  71. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/src/evalsuite/vision/segmentation.py +0 -0
  72. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/__init__.py +0 -0
  73. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/classification/__init__.py +0 -0
  74. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/classification/test_against_sklearn.py +0 -0
  75. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/clinical/__init__.py +0 -0
  76. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/clinical/test_outputs.py +0 -0
  77. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/clinical/test_v020.py +0 -0
  78. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/conftest.py +0 -0
  79. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/integration/__init__.py +0 -0
  80. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/integration/test_qa.py +0 -0
  81. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/integration/test_readme_examples.py +0 -0
  82. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/integration/test_repo_hygiene.py +0 -0
  83. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/__init__.py +0 -0
  84. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/test_code_longcontext_efficiency.py +0 -0
  85. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/test_edges.py +0 -0
  86. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/test_hardening.py +0 -0
  87. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/test_safety_robustness.py +0 -0
  88. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/llmsys/test_uncertainty_agents_multilingual.py +0 -0
  89. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/output/__init__.py +0 -0
  90. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/output/test_benchmarks.py +0 -0
  91. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/output/test_cli.py +0 -0
  92. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/output/test_plot.py +0 -0
  93. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/output/test_reporting.py +0 -0
  94. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/regression/__init__.py +0 -0
  95. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/regression/test_against_sklearn.py +0 -0
  96. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/stats/__init__.py +0 -0
  97. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/stats/test_branches.py +0 -0
  98. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/stats/test_compare.py +0 -0
  99. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/stats/test_reference.py +0 -0
  100. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/text/__init__.py +0 -0
  101. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/text/test_against_references.py +0 -0
  102. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/text/test_text_edges.py +0 -0
  103. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/text/test_v040.py +0 -0
  104. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/unit/__init__.py +0 -0
  105. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/unit/test_core.py +0 -0
  106. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/unit/test_edges.py +0 -0
  107. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/vision/__init__.py +0 -0
  108. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/vision/test_detection.py +0 -0
  109. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/vision/test_edges.py +0 -0
  110. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/vision/test_outputs.py +0 -0
  111. {evalsuite_python-0.5.2 → evalsuite_python-0.5.3}/tests/vision/test_segmentation.py +0 -0
@@ -6,6 +6,21 @@ All notable changes to this project are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.3] - 2026-11-09
10
+
11
+ Performance release; benchmarks rerun. No API changes.
12
+
13
+ ### Changed
14
+ - `t_test` computes the t statistic and its p-value directly (Student-t tail via `scipy.special.stdtr`) from
15
+ one pass over each sample instead of calling `scipy.stats.ttest_ind` and recomputing means and variances;
16
+ identical to SciPy within 1e-15 and now faster than it (was 0.43×).
17
+ - `latency_percentiles` and every LLM-systems latency/step/token summary take min, max and all percentiles
18
+ from a single `np.partition` instead of separate `np.percentile` calls (identical values, ~1.4× faster).
19
+ - Statistical tests no longer copy inputs that are already float64.
20
+ - CI: Python 3.9 tests run on ubuntu-22.04 (ubuntu-latest no longer ships 3.9); GitHub Actions updated
21
+ (checkout 7.0.1, setup-python 7.1.0, upload-artifact 7.0.2, download-artifact 8.0.2).
22
+ - README and BENCHMARKS.md: all suites and the per-metric table rerun on 0.5.3.
23
+
9
24
  ## [0.5.2] - 2026-11-07
10
25
 
11
26
  Security and performance hardening. No API changes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: evalsuite-python
3
- Version: 0.5.2
3
+ Version: 0.5.3
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
@@ -83,7 +83,7 @@ Description-Content-Type: text/markdown
83
83
  EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
84
84
  evaluation into one consistent, validated, documented framework.
85
85
 
86
- > **Status: stable (0.5.2).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
86
+ > **Status: stable (0.5.3).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
87
87
  > **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
88
88
  > multilingual, code generation, long context and summarization, and inference efficiency and cost.
89
89
 
@@ -339,51 +339,51 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
339
339
 
340
340
  ## Performance
341
341
 
342
- Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.5.1, Python 3.13,
342
+ Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.5.3, Python 3.13,
343
343
  NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
344
- difference 2.5e-14), 56 are faster, and the geometric-mean speed-up across all
345
- 27 cases and three sizes is **1.89×**. At 1,000,000 samples (pixels for
344
+ difference 2.5e-14), 58 are faster, and the geometric-mean speed-up across all
345
+ 27 cases and three sizes is **2.06×**. At 1,000,000 samples (pixels for
346
346
  segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
347
347
  alphabetical order:
348
348
 
349
349
  | Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
350
350
  | --- | --- | ---: | ---: | ---: |
351
- | 10 classes: macro F1 | scikit-learn | 41.5 | 137.6 | **3.3×** |
352
- | agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 4.5 | 4.5 | **1.0×** |
353
- | binary: 8 label metrics via evaluate() | scikit-learn | 49.4 | 1056.8 | **21.4×** |
354
- | binary: ROC AUC | scikit-learn | 200.3 | 338.5 | **1.7×** |
355
- | calibration: slope and intercept | statsmodels | 344.3 | 1541.7 | **4.5×** |
356
- | clinical: diagnostic report (7 CIs) | statsmodels | 33.5 | 9.6 | 0.29× |
357
- | clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 137.9 | 438.1 | **3.2×** |
358
- | decision curve: 99 thresholds | NumPy loop | 172.1 | 236.2 | **1.4×** |
359
- | detection: COCO evaluation (1000 images) | pycocotools | 1147.9 | 1351.0 | **1.2×** |
360
- | multiple testing: Hochberg (n p-values) | statsmodels | 91.9 | 98.4 | **1.1×** |
361
- | regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 32.0 | 22.6 | 0.71× |
362
- | retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 248.6 | 897.0 | **3.6×** |
363
- | segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 51.6 | 289.5 | **5.6×** |
364
- | segmentation: Hausdorff distance (50 images) | SciPy | 31.9 | 23.8 | 0.75× |
365
- | statistics: Cramér's V (5×5 table) | SciPy | 0.3 | 0.3 | 0.95× |
366
- | statistics: Mann–Whitney U | SciPy | 390.3 | 425.8 | **1.1×** |
367
- | statistics: Welch t-test | SciPy | 37.7 | 16.3 | 0.43× |
368
- | structured: JSON Schema compliance (10000 documents) | jsonschema | 159.4 | 371.7 | **2.3×** |
369
- | systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 740.3 | 791.9 | **1.1×** |
370
- | systems: confidence AUROC (n answers) | scikit-learn | 194.4 | 327.7 | **1.7×** |
371
- | systems: distribution-shift drop, Welch CI (n scores) | SciPy | 13.3 | 16.9 | **1.3×** |
372
- | systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 145.0 | 333.2 | **2.3×** |
373
- | systems: latency p50 / p95 / p99 (n requests) | NumPy | 41.0 | 19.7 | 0.48× |
374
- | systems: maintainability index (1000 programs) | radon | 138.3 | 168.7 | **1.2×** |
375
- | text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 2726.2 | 3121.0 | **1.1×** |
376
- | text: METEOR, exact and stem matches (10000 sentences) | NLTK | 507.4 | 590.3 | **1.2×** |
377
- | text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 1147.3 | 1010.7 | 0.88× |
351
+ | 10 classes: macro F1 | scikit-learn | 35.9 | 122.1 | **3.4×** |
352
+ | agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 4.4 | 3.4 | 0.77× |
353
+ | binary: 8 label metrics via evaluate() | scikit-learn | 23.3 | 866.5 | **37.2×** |
354
+ | binary: ROC AUC | scikit-learn | 187.9 | 305.7 | **1.6×** |
355
+ | calibration: slope and intercept | statsmodels | 236.6 | 1085.8 | **4.6×** |
356
+ | clinical: diagnostic report (7 CIs) | statsmodels | 26.2 | 5.7 | 0.22× |
357
+ | clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 122.9 | 353.9 | **2.9×** |
358
+ | decision curve: 99 thresholds | NumPy loop | 167.3 | 238.1 | **1.4×** |
359
+ | detection: COCO evaluation (1000 images) | pycocotools | 684.7 | 660.8 | 0.97× |
360
+ | multiple testing: Hochberg (n p-values) | statsmodels | 71.3 | 92.4 | **1.3×** |
361
+ | regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 27.3 | 18.8 | 0.69× |
362
+ | retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 129.5 | 614.7 | **4.7×** |
363
+ | segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 35.7 | 235.1 | **6.6×** |
364
+ | segmentation: Hausdorff distance (50 images) | SciPy | 18.8 | 13.6 | 0.72× |
365
+ | statistics: Cramér's V (5×5 table) | SciPy | 0.2 | 0.2 | 0.90× |
366
+ | statistics: Mann–Whitney U | SciPy | 342.3 | 325.8 | 0.95× |
367
+ | statistics: Welch t-test | SciPy | 8.2 | 11.9 | **1.4×** |
368
+ | structured: JSON Schema compliance (10000 documents) | jsonschema | 93.9 | 223.5 | **2.4×** |
369
+ | systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 413.8 | 507.8 | **1.2×** |
370
+ | systems: confidence AUROC (n answers) | scikit-learn | 154.1 | 251.8 | **1.6×** |
371
+ | systems: distribution-shift drop, Welch CI (n scores) | SciPy | 10.9 | 12.9 | **1.2×** |
372
+ | systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 78.4 | 213.2 | **2.7×** |
373
+ | systems: latency p50 / p95 / p99 (n requests) | NumPy | 18.0 | 15.9 | 0.88× |
374
+ | systems: maintainability index (1000 programs) | radon | 89.3 | 96.0 | **1.1×** |
375
+ | text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 1728.8 | 1993.1 | **1.2×** |
376
+ | text: METEOR, exact and stem matches (10000 sentences) | NLTK | 319.1 | 358.6 | **1.1×** |
377
+ | text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 716.0 | 612.5 | 0.86× |
378
378
 
379
379
  **Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
380
380
  statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
381
381
  independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
382
- comparisons agree**, and against the libraries the geometric-mean speed-up is **2.67×** (139 of 172
382
+ comparisons agree**, and against the libraries the geometric-mean speed-up is **2.80×** (138 of 172
383
383
  measurements faster). Per-metric table in BENCHMARKS.md.
384
384
 
385
385
  `evaluate()` validates inputs once and builds the confusion matrix once for all metrics, which is where most
386
- of the speed-up comes from. Hypothesis tests use SciPy underneath, so they match its speed at best; rows
386
+ of the speed-up comes from. The t-tests compute their statistics in one pass and beat SciPy; other hypothesis tests use SciPy underneath. Rows
387
387
  below 1× pay for input validation and the extra intervals and effect sizes EvalSuite reports. Reproduce on
388
388
  your machine with `evalsuite benchmark`; full table (1k, 100k and 1M samples, peak memory) and notes in
389
389
  [BENCHMARKS.md](https://github.com/mkcs28/evalsuite-python/blob/main/BENCHMARKS.md).
@@ -10,7 +10,7 @@
10
10
  EvalSuite brings classification, regression, clinical, statistical, segmentation and object-detection
11
11
  evaluation into one consistent, validated, documented framework.
12
12
 
13
- > **Status: stable (0.5.2).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
13
+ > **Status: stable (0.5.3).** Every item on the 0.1.0–0.5.0 roadmaps is implemented and verified, including SPICE.
14
14
  > **LLM systems arrive in 0.5.0**: safety, robustness, calibration and uncertainty, agents and tool use,
15
15
  > multilingual, code generation, long context and summarization, and inference efficiency and cost.
16
16
 
@@ -266,51 +266,51 @@ Input files can be CSV, TSV, Parquet or JSON. Output format follows `--format` o
266
266
 
267
267
  ## Performance
268
268
 
269
- Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.5.1, Python 3.13,
269
+ Benchmarked against reference implementations on the same data (fastest of 5 runs; EvalSuite 0.5.3, Python 3.13,
270
270
  NumPy 2.5, Linux x86_64). **Overall: 81 of 81 rows agree with the reference** (largest
271
- difference 2.5e-14), 56 are faster, and the geometric-mean speed-up across all
272
- 27 cases and three sizes is **1.89×**. At 1,000,000 samples (pixels for
271
+ difference 2.5e-14), 58 are faster, and the geometric-mean speed-up across all
272
+ 27 cases and three sizes is **2.06×**. At 1,000,000 samples (pixels for
273
273
  segmentation; 1,000 images for detection and 50 for Hausdorff; 10,000 examples for the LLM cases), in
274
274
  alphabetical order:
275
275
 
276
276
  | Case | Reference | EvalSuite (ms) | Reference (ms) | Speed-up |
277
277
  | --- | --- | ---: | ---: | ---: |
278
- | 10 classes: macro F1 | scikit-learn | 41.5 | 137.6 | **3.3×** |
279
- | agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 4.5 | 4.5 | **1.0×** |
280
- | binary: 8 label metrics via evaluate() | scikit-learn | 49.4 | 1056.8 | **21.4×** |
281
- | binary: ROC AUC | scikit-learn | 200.3 | 338.5 | **1.7×** |
282
- | calibration: slope and intercept | statsmodels | 344.3 | 1541.7 | **4.5×** |
283
- | clinical: diagnostic report (7 CIs) | statsmodels | 33.5 | 9.6 | 0.29× |
284
- | clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 137.9 | 438.1 | **3.2×** |
285
- | decision curve: 99 thresholds | NumPy loop | 172.1 | 236.2 | **1.4×** |
286
- | detection: COCO evaluation (1000 images) | pycocotools | 1147.9 | 1351.0 | **1.2×** |
287
- | multiple testing: Hochberg (n p-values) | statsmodels | 91.9 | 98.4 | **1.1×** |
288
- | regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 32.0 | 22.6 | 0.71× |
289
- | retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 248.6 | 897.0 | **3.6×** |
290
- | segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 51.6 | 289.5 | **5.6×** |
291
- | segmentation: Hausdorff distance (50 images) | SciPy | 31.9 | 23.8 | 0.75× |
292
- | statistics: Cramér's V (5×5 table) | SciPy | 0.3 | 0.3 | 0.95× |
293
- | statistics: Mann–Whitney U | SciPy | 390.3 | 425.8 | **1.1×** |
294
- | statistics: Welch t-test | SciPy | 37.7 | 16.3 | 0.43× |
295
- | structured: JSON Schema compliance (10000 documents) | jsonschema | 159.4 | 371.7 | **2.3×** |
296
- | systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 740.3 | 791.9 | **1.1×** |
297
- | systems: confidence AUROC (n answers) | scikit-learn | 194.4 | 327.7 | **1.7×** |
298
- | systems: distribution-shift drop, Welch CI (n scores) | SciPy | 13.3 | 16.9 | **1.3×** |
299
- | systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 145.0 | 333.2 | **2.3×** |
300
- | systems: latency p50 / p95 / p99 (n requests) | NumPy | 41.0 | 19.7 | 0.48× |
301
- | systems: maintainability index (1000 programs) | radon | 138.3 | 168.7 | **1.2×** |
302
- | text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 2726.2 | 3121.0 | **1.1×** |
303
- | text: METEOR, exact and stem matches (10000 sentences) | NLTK | 507.4 | 590.3 | **1.2×** |
304
- | text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 1147.3 | 1010.7 | 0.88× |
278
+ | 10 classes: macro F1 | scikit-learn | 35.9 | 122.1 | **3.4×** |
279
+ | agreement: Krippendorff's alpha, interval (4 raters × 10000 items) | krippendorff | 4.4 | 3.4 | 0.77× |
280
+ | binary: 8 label metrics via evaluate() | scikit-learn | 23.3 | 866.5 | **37.2×** |
281
+ | binary: ROC AUC | scikit-learn | 187.9 | 305.7 | **1.6×** |
282
+ | calibration: slope and intercept | statsmodels | 236.6 | 1085.8 | **4.6×** |
283
+ | clinical: diagnostic report (7 CIs) | statsmodels | 26.2 | 5.7 | 0.22× |
284
+ | clinical: sensitivity, specificity, LR+, LR− | scikit-learn | 122.9 | 353.9 | **2.9×** |
285
+ | decision curve: 99 thresholds | NumPy loop | 167.3 | 238.1 | **1.4×** |
286
+ | detection: COCO evaluation (1000 images) | pycocotools | 684.7 | 660.8 | 0.97× |
287
+ | multiple testing: Hochberg (n p-values) | statsmodels | 71.3 | 92.4 | **1.3×** |
288
+ | regression: MAE, MSE, RMSE, R² via evaluate() | scikit-learn | 27.3 | 18.8 | 0.69× |
289
+ | retrieval: MRR, MAP@20, NDCG@10 (10000 queries) | ranx | 129.5 | 614.7 | **4.7×** |
290
+ | segmentation: Dice and IoU per class (n = pixels) | scikit-learn | 35.7 | 235.1 | **6.6×** |
291
+ | segmentation: Hausdorff distance (50 images) | SciPy | 18.8 | 13.6 | 0.72× |
292
+ | statistics: Cramér's V (5×5 table) | SciPy | 0.2 | 0.2 | 0.90× |
293
+ | statistics: Mann–Whitney U | SciPy | 342.3 | 325.8 | 0.95× |
294
+ | statistics: Welch t-test | SciPy | 8.2 | 11.9 | **1.4×** |
295
+ | structured: JSON Schema compliance (10000 documents) | jsonschema | 93.9 | 223.5 | **2.4×** |
296
+ | systems: CodeBLEU n-gram terms (1000 programs) | codebleu | 413.8 | 507.8 | **1.2×** |
297
+ | systems: confidence AUROC (n answers) | scikit-learn | 154.1 | 251.8 | **1.6×** |
298
+ | systems: distribution-shift drop, Welch CI (n scores) | SciPy | 10.9 | 12.9 | **1.2×** |
299
+ | systems: invalid tool calls vs JSON Schema (10000 tasks) | jsonschema | 78.4 | 213.2 | **2.7×** |
300
+ | systems: latency p50 / p95 / p99 (n requests) | NumPy | 18.0 | 15.9 | 0.88× |
301
+ | systems: maintainability index (1000 programs) | radon | 89.3 | 96.0 | **1.1×** |
302
+ | text: corpus BLEU and chrF (10000 sentences) | sacreBLEU | 1728.8 | 1993.1 | **1.2×** |
303
+ | text: METEOR, exact and stem matches (10000 sentences) | NLTK | 319.1 | 358.6 | **1.1×** |
304
+ | text: ROUGE-1, ROUGE-2, ROUGE-L (10000 sentences) | rouge-score | 716.0 | 612.5 | 0.86× |
305
305
 
306
306
  **Every metric is benchmarked too** (`evalsuite benchmark --suite metrics`): all 225 registered metrics and
307
307
  statistics functions at 10,000 and 100,000 samples. 86 are compared with a reference library, 118 with an
308
308
  independent textbook formula and 21 (learned, judge-dependent or randomised) are timed alone; **all 204
309
- comparisons agree**, and against the libraries the geometric-mean speed-up is **2.67×** (139 of 172
309
+ comparisons agree**, and against the libraries the geometric-mean speed-up is **2.80×** (138 of 172
310
310
  measurements faster). Per-metric table in BENCHMARKS.md.
311
311
 
312
312
  `evaluate()` validates inputs once and builds the confusion matrix once for all metrics, which is where most
313
- of the speed-up comes from. Hypothesis tests use SciPy underneath, so they match its speed at best; rows
313
+ of the speed-up comes from. The t-tests compute their statistics in one pass and beat SciPy; other hypothesis tests use SciPy underneath. Rows
314
314
  below 1× pay for input validation and the extra intervals and effect sizes EvalSuite reports. Reproduce on
315
315
  your machine with `evalsuite benchmark`; full table (1k, 100k and 1M samples, peak memory) and notes in
316
316
  [BENCHMARKS.md](https://github.com/mkcs28/evalsuite-python/blob/main/BENCHMARKS.md).
@@ -113,19 +113,38 @@ def by_group(values: np.ndarray, groups: Optional[Sequence[Any]], name: str = "g
113
113
  return out
114
114
 
115
115
 
116
- def summary(a: np.ndarray) -> dict[str, float]:
117
- """Mean, standard deviation, min, max and the p50/p90/p95/p99 percentiles (linear interpolation)."""
118
- p50, p90, p95, p99 = np.percentile(a, [50, 90, 95, 99])
119
- return {
116
+ def quantiles(a: np.ndarray, qs: Sequence[float]) -> list[float]:
117
+ """Percentiles ``qs`` (0-100, linear interpolation, identical to ``np.percentile``) from one partition."""
118
+ n = a.size
119
+ pos = [(n - 1) * q / 100.0 for q in qs]
120
+ lo = [int(np.floor(h)) for h in pos]
121
+ kth = sorted({k for i in lo for k in (i, min(i + 1, n - 1))})
122
+ part = np.partition(a, kth)
123
+ out = []
124
+ for h, i in zip(pos, lo):
125
+ v0, v1 = float(part[i]), float(part[min(i + 1, n - 1)])
126
+ out.append(v0 + (h - i) * (v1 - v0))
127
+ return out
128
+
129
+
130
+ def summary(a: np.ndarray, extra: Sequence[float] = ()) -> dict[str, float]:
131
+ """Mean, standard deviation, min, max and the p50/p90/p95/p99 percentiles (linear interpolation), plus any
132
+ ``extra`` percentiles under keys ``p<q>``; all order statistics come from one partition."""
133
+ qs = [0.0, 50.0, 90.0, 95.0, 99.0, 100.0, *extra]
134
+ v = quantiles(a, qs)
135
+ out = {
120
136
  "mean": float(a.mean()),
121
137
  "std": float(a.std(ddof=1)) if a.size > 1 else 0.0,
122
- "min": float(a.min()),
123
- "max": float(a.max()),
124
- "p50": float(p50),
125
- "p90": float(p90),
126
- "p95": float(p95),
127
- "p99": float(p99),
138
+ "min": v[0],
139
+ "max": v[5],
140
+ "p50": v[1],
141
+ "p90": v[2],
142
+ "p95": v[3],
143
+ "p99": v[4],
128
144
  }
145
+ for q, val in zip(extra, v[6:]):
146
+ out[f"p{q:g}"] = val
147
+ return out
129
148
 
130
149
 
131
150
  def lists_of(x: Any, name: str) -> list[list[Any]]:
@@ -119,10 +119,9 @@ def latency_percentiles(latencies: Any, *, unit: str = "s", percentile: float =
119
119
  x = floats(latencies, "latencies", lo=0)
120
120
  if not 0 <= percentile <= 100:
121
121
  raise InputValidationError("percentile must be in [0, 100].")
122
- s = summary(x)
123
- return MetricResult(
124
- "latency_percentiles", f"p{percentile:g} latency", float(np.percentile(x, percentile)), {"unit": unit, **s}
125
- )
122
+ s = summary(x, extra=(percentile,))
123
+ value = s[f"p{percentile:g}"]
124
+ return MetricResult("latency_percentiles", f"p{percentile:g} latency", value, {"unit": unit, **s})
126
125
 
127
126
 
128
127
  @register(
@@ -14,10 +14,11 @@ import numpy as np
14
14
  from numpy.typing import NDArray
15
15
 
16
16
  if TYPE_CHECKING:
17
- from scipy import stats
17
+ from scipy import special, stats
18
18
  else:
19
19
  from .._lazy import lazy_module
20
20
 
21
+ special = lazy_module("scipy.special")
21
22
  stats = lazy_module("scipy.stats")
22
23
 
23
24
  from ..core.exceptions import InputValidationError, StatisticalTestError
@@ -43,7 +44,7 @@ _ALTS = ("two-sided", "greater", "less")
43
44
 
44
45
 
45
46
  def _vec(x: ArrayLike, name: str, min_n: int = 2) -> NDArray[np.float64]:
46
- a = to_numpy(x, name).astype(np.float64)
47
+ a = to_numpy(x, name).astype(np.float64, copy=False)
47
48
  check_finite(a, name)
48
49
  if a.ndim != 1:
49
50
  raise InputValidationError(f"{name} must be one-dimensional.")
@@ -86,12 +87,15 @@ def t_test(
86
87
  References: Welch BL. Biometrika. 1947;34(1-2):28-35. Student. Biometrika. 1908;6(1):1-25.
87
88
  """
88
89
  level = _check_level(level)
90
+ _alt(alternative)
89
91
  x, y = _vec(a, "a"), _vec(b, "b")
90
- if x.var() == 0 and y.var() == 0:
91
- raise StatisticalTestError("The t-test is undefined: both samples have zero variance.")
92
- res = stats.ttest_ind(x, y, equal_var=equal_var, alternative=_alt(alternative))
93
92
  n1, n2 = x.shape[0], y.shape[0]
94
- v1, v2 = x.var(ddof=1), y.var(ddof=1)
93
+ m1, m2 = float(x.mean()), float(y.mean())
94
+ # Two-pass variances (as NumPy/SciPy compute them), each sample read once more.
95
+ v1 = float(np.dot(x - m1, x - m1)) / (n1 - 1)
96
+ v2 = float(np.dot(y - m2, y - m2)) / (n2 - 1)
97
+ if v1 == 0 and v2 == 0:
98
+ raise StatisticalTestError("The t-test is undefined: both samples have zero variance.")
95
99
  if equal_var:
96
100
  df = n1 + n2 - 2
97
101
  sp2 = ((n1 - 1) * v1 + (n2 - 1) * v2) / df
@@ -99,12 +103,21 @@ def t_test(
99
103
  else:
100
104
  se = math.sqrt(v1 / n1 + v2 / n2)
101
105
  df = (v1 / n1 + v2 / n2) ** 2 / ((v1 / n1) ** 2 / (n1 - 1) + (v2 / n2) ** 2 / (n2 - 1)) if se else math.nan
102
- diff = float(x.mean() - y.mean())
106
+ t = (m1 - m2) / se
107
+ # Student-t tail probabilities directly (what scipy.stats.ttest_ind returns), without re-reading the data.
108
+ if alternative == "two-sided":
109
+ p = 2.0 * float(special.stdtr(df, -abs(t)))
110
+ elif alternative == "less":
111
+ p = float(special.stdtr(df, t))
112
+ else:
113
+ p = float(special.stdtr(df, -t))
114
+ p = min(p, 1.0)
115
+ diff = m1 - m2
103
116
  pooled = math.sqrt(((n1 - 1) * v1 + (n2 - 1) * v2) / (n1 + n2 - 2))
104
117
  return TestResult(
105
118
  "welch-t" if not equal_var else "student-t",
106
- float(res.statistic),
107
- float(res.pvalue),
119
+ float(t),
120
+ p,
108
121
  alternative=alternative,
109
122
  estimate=diff,
110
123
  ci=_mean_diff_ci(diff, se, df, level, alternative, "mean_difference"),
@@ -1,3 +1,3 @@
1
1
  """Package version (single source of truth, read by the build backend)."""
2
2
 
3
- __version__ = "0.5.2"
3
+ __version__ = "0.5.3"
@@ -0,0 +1,30 @@
1
+ """The one-pass t-test and single-partition percentiles must equal SciPy / NumPy exactly."""
2
+
3
+ import numpy as np
4
+ import pytest
5
+ from scipy import stats
6
+
7
+ import evalsuite as es
8
+
9
+
10
+ @pytest.mark.parametrize("equal_var", [False, True])
11
+ @pytest.mark.parametrize("alternative", ["two-sided", "less", "greater"])
12
+ @pytest.mark.parametrize(("n1", "n2", "shift"), [(2, 2, 0.0), (3, 30, 0.4), (500, 400, -0.1), (50, 60, 30.0)])
13
+ def test_t_test_matches_scipy(equal_var, alternative, n1, n2, shift):
14
+ rng = np.random.default_rng(n1 + n2)
15
+ a, b = rng.normal(0, 1, n1), rng.normal(shift, 2.0, n2)
16
+ got = es.t_test(a, b, equal_var=equal_var, alternative=alternative)
17
+ ref = stats.ttest_ind(a, b, equal_var=equal_var, alternative=alternative)
18
+ assert got.statistic == pytest.approx(ref.statistic, rel=1e-12)
19
+ assert got.p_value == pytest.approx(ref.pvalue, rel=1e-9, abs=1e-15)
20
+
21
+
22
+ @pytest.mark.parametrize("n", [1, 2, 3, 10, 1001])
23
+ @pytest.mark.parametrize("q", [0, 12.5, 50, 95, 99.9, 100])
24
+ def test_latency_percentiles_match_numpy(n, q):
25
+ x = np.random.default_rng(n).lognormal(0, 0.5, n)
26
+ r = es.latency_percentiles(x, percentile=q)
27
+ assert float(r) == pytest.approx(np.percentile(x, q), rel=1e-12)
28
+ for key, p in (("p50", 50), ("p90", 90), ("p95", 95), ("p99", 99)):
29
+ assert r.params[key] == pytest.approx(np.percentile(x, p), rel=1e-12)
30
+ assert r.params["min"] == x.min() and r.params["max"] == x.max()