Skip to content

feat(pooling): report AIC weights per partition and fit each subset once - #51

Merged
seanthimons merged 1 commit into
mainfrom
feat/pooling-fit-cache
Nov 17, 2026
Merged

seanthimons merged 1 commit into
mainfrom
feat/pooling-fit-cache

Conversation

@seanthimons

Copy link
Copy Markdown
Owner

Summary

Before vs after (Cryptosporidium, 6 studies)

Call Before After Fits before → after
exhaustive 60.6 s 6.1 s 788 → 126
agglomerative 8.5 s 5.3 s 111 → 61
poolability_combinations() 26.1 s 6.3 s 486 → 126

On pooling-example.csv and cryptosporidium-isolates.csv, every output is identical() to the previous build, including the agglomerative path.

Behaviour notes

  • Warnings: convergence warnings now fire once per distinct subset instead of once per refit (39 → 3 on the exhaustive search above). The app and data-raw/pooling-article-results.R already deduplicate warnings.
  • Row order: the cache stacks each subset's datasets in sorted index order. Agglomerative merges used to stack them in merge order. The likelihood doesn't depend on row order, and outputs are unchanged on both bundled datasets.
  • New dependency: partitions imports gmp. Installing from source needs the system library libgmp; P3M and CRAN serve binaries.

Test plan

  • Full testthat suite: 0 failures. 6 skipped because mirai isn't installed or the slow oracle is turned off.
  • New tests: the partitions table on the bundled example, each subset fitted once (7 and 14 fit calls), and partition order kept.
  • Before/after identical() check on both bundled datasets.
  • CI installs gmp/partitions on all platforms.

Replaces #50, which closed when its branch was renamed from perf/ to feat/ to satisfy commit lint.

group_datasets(method = "exhaustive") attaches a "partitions" attribute with
one row per set partition: min_p_value, all_groups_poolable, delta_aic,
aic_weight and selected. AIC weights are a diagnostic; the likelihood-ratio
selection rule is unchanged.

Pooling now fits each distinct subset of datasets once per call and reuses it
across pairwise tests, the partition search and poolability_combinations().
On the six Cryptosporidium studies the exhaustive search drops from 60.6 s to
6.1 s (788 -> 126 fits); all outputs are identical to the previous build.
Convergence warnings now fire once per distinct subset rather than per refit.

Set partitions come from partitions::setparts() instead of a hand-rolled
recursion, in the same order, so tie-breaks are unchanged.

Closes #39. Refs #49.
@seanthimons
seanthimons merged commit 915c26a into main Nov 17, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed up group_datasets() exhaustive search (cache fits) and the app's exploration

1 participant