Skip to main content

groupeval

Evaluation that respects the group structure benchmarks actually have.

Most vision and medical-imaging benchmarks are built from groups (video frames of one lesion, slices of one scan, crops of one slide, images of one patient) and then scored as if every file were an independent observation. Three things go wrong:

problem what it looks like what groupeval does
duplicates the same image in two "independent" test sets, or twice in one exact pixel audit, no thresholds
splits train/test separates files but not groups group-disjoint splits, leakage asserted
intervals confidence intervals computed over files cluster bootstrap and design effect
resolution "not significant", but is that the data or the compute? variance decomposition and a floor
from groupeval import audit_duplicates, multi_seed_splits, cluster_ci, naive_ci, paired_group_test

report = audit_duplicates({"train": train_paths, "test_a": a_paths, "test_b": b_paths},
                          to_array=lambda p: np.asarray(Image.open(p)))
print(report.summary())

splits = multi_seed_splits(frame_to_lesion, n_seeds=5, test_fraction=0.2)

honest = cluster_ci(dice_per_frame, lesion_of_frame)
print(honest.width / naive_ci(dice_per_frame).width, "x wider than the file-level interval")

verdict = paired_group_test(dice_model_a, dice_model_b, lesion_of_frame)
print(verdict, "significant" if verdict.excludes_zero else "not distinguishable")

Three things it will tell you that you may not want to hear

Small correlations are not small problems. At 25 files per group, an intra-group correlation of 0.1 already inflates the standard error by 1.9×. Whether that matters is arithmetic, not judgement.

Pairing usually matters more than the correction. If two methods were scored on the same items, paired_group_test is typically 2–3× sharper than the unpaired form. Using the unpaired test on paired data can turn a real difference into noise.

More compute may not help. On a fixed test set, decompose_variance separates the part of your uncertainty that more training runs shrink from the part they never touch. If the differences your field reports sit below that floor, the only remedy is more independent groups, and required_groups prices it.

Unverifiable grouping is not a dead end. When part of your data ships no grouping metadata, independence_sensitivity sweeps the possibilities and includes the case that needs no assumption at all: deleting those items, which is strictly more pessimistic than any grouping of them. If your conclusion survives that row, the unknown stops mattering.

from groupeval import independence_sensitivity
rows = independence_sensitivity(scores, suspect=unlabelled_items, counts=(50, 25, 10))
print(rows[-1])   # the assumption-free worst case

A confident interval is not the same as a robust result. When one side of a comparison is a fixed subset of the data, no bootstrap explores which groups landed in it. leave_one_group_out drops each group in turn and tells you whether the sign survives: on the benchmark this package came from, a contrast of +0.133 with an interval of [+0.128, +0.138] reversed to −0.136 when one group was removed.

from groupeval import leave_one_group_out
r = leave_one_group_out(scores, groups, mask=in_the_subset)
r["sign_stable"], r["largest_share_fraction"]

Install

pip install groupeval

Depends on numpy only.

Provenance

Built while auditing a widely used medical-imaging benchmark, where the file-level convention had kept a duplicated test set invisible for six years and made every published confidence interval two to four times too narrow. The tools are dataset-agnostic because the mistake is.

MIT licensed.

Metadata

Release files for groupeval 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for groupeval 0.1.0
File Size Uploaded Provenance Actions
groupeval-0.1.0.tar.gz 33.4 kB Without provenance Details for groupeval-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for groupeval 0.1.0
File Interpreter ABI Platform Actions
groupeval-0.1.0-py3-none-any.whl Python 3 none any Details for groupeval-0.1.0-py3-none-any.whl

Total release size: 52.9 kB

Release files / groupeval-0.1.0.tar.gz

Download URL groupeval-0.1.0.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
50c21074a9e675e10587a5233e90c11cbb3bc11c218856a87811835ab7dbe762
BLAKE2b-256 checksum
How to use checksums
15419cc6a4fe0d27d488e3a4acf66c6d7172c91b14447eae82878c6a1855b146
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / groupeval-0.1.0-py3-none-any.whl

Download URL groupeval-0.1.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca24974ebfd497fef706da57124802730228ba087d16aec5e400895f55cb95cb
BLAKE2b-256 checksum
How to use checksums
28355b49d2def5d2b5ee6996d1ad1d77d20fc2da9850b83e733b3a27b216ba8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for groupeval 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page