Skip to content

Keep scCODA and tascCODA working under numpyro 0.22 - #1104

Merged
Zethson merged 3 commits into
mainfrom
fix/numpyro-validation
Sep 18, 2026
Merged

Zethson merged 3 commits into
mainfrom
fix/numpyro-validation

Conversation

@Zethson

@Zethson Zethson commented Sep 18, 2026

Copy link
Copy Markdown
Member

numpyro 0.22 enables distribution validation by default, which rejects the fractional counts scCODA creates with its 0.5 pseudocount and makes run_nuts() fail with "Cannot find valid initial parameters".
The count likelihood now opts out of validation, since its log-prob is well defined for fractional counts, and the prior predictive rounds the number of trials.

numpyro 0.22 turns distribution validation on by default. scCODA replaces zero
counts with a pseudocount of 0.5, so `counts` and the derived `n_total` fall
outside the discrete DirichletMultinomial support: sampling now raises and NUTS
initialization fails with "Cannot find valid initial parameters". The log-prob
itself is well defined for fractional counts, so the likelihood site opts out of
validation, and the prior predictive rounds the number of trials, which is the
only well-defined choice when actually drawing counts.

Verified against numpyro 0.22.0 in the pertpy conda env: all 11 tests in
tests/tools/_coda pass, where run_nuts and make_arviz failed before.
@codecov-commenter

codecov-commenter commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.96%. Comparing base (af8a836) to head (d2aaab6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1104      +/-   ##
==========================================
+ Coverage   79.94%   79.96%   +0.02%     
==========================================
  Files          55       55              
  Lines        7533     7533              
==========================================
+ Hits         6022     6024       +2     
+ Misses       1511     1509       -2     
Files with missing lines Coverage Δ
src/pertpy/tools/_coda/_base_coda.py 61.06% <ø> (+0.31%) ⬆️
src/pertpy/tools/_coda/_sccoda.py 88.23% <100.00%> (ø)
src/pertpy/tools/_coda/_tasccoda.py 76.74% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zethson
Zethson merged commit e21d9b7 into main Sep 18, 2026
23 checks passed
@Zethson
Zethson deleted the fix/numpyro-validation branch September 18, 2026 11:35
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.

2 participants