Datasets:
Formats:
parquet
Languages:
English
Size:
10K - 100K
Tags:
agriculture
plant-disease
crop-disease
vision-language-model
retrieval-augmented-generation
memory
License:
Download code/agmem/stats.py from tirtho149/MACE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 663 Bytes
-
https://huggingface.co/datasets/tirtho149/MACE-Bench/resolve/main/code/agmem/stats.py
- Command line
-
hf download hf://datasets/tirtho149/MACE-Bench/code/agmem/stats.py
-
curl -L -o stats.py https://huggingface.co/datasets/tirtho149/MACE-Bench/resolve/main/code/agmem/stats.py
663 Bytes
| """Exact McNemar test and Holm correction (no SciPy dependency).""" | |
| from __future__ import annotations | |
| from math import comb | |
| def mcnemar_exact(b: int, c: int) -> float: | |
| """Two-sided exact McNemar p-value from the discordant counts b and c.""" | |
| n = b + c | |
| if n == 0: | |
| return 1.0 | |
| k = min(b, c) | |
| return min(1.0, 2 * sum(comb(n, i) for i in range(k + 1)) / 2 ** n) | |
| def holm(ps: list[float]) -> list[float]: | |
| order = sorted(range(len(ps)), key=lambda i: ps[i]); out = [0.0] * len(ps); running = 0.0 | |
| for rank, i in enumerate(order): | |
| running = max(running, min(1.0, (len(ps) - rank) * ps[i])); out[i] = running | |
| return out | |