Fix tascCODA returning no credible effects (theta collapse)#1017
Open
Zethson wants to merge 1 commit into
Open
Fix tascCODA returning no credible effects (theta collapse)#1017Zethson wants to merge 1 commit into
Zethson wants to merge 1 commit into
Conversation
tascCODA returned zero credible effects because the global spike-and-slab mixing weight theta collapses to its Beta(1, d) prior (~0.01) under numpyro NUTS, which sends the selection threshold delta to infinity and zeroes out every node effect (issue #1015). This is the model's true marginal posterior, not a sampler bug: a single global theta gates a high-dimensional slab, so the low-theta funnel mouth carries almost all the marginal volume. The reference TFP implementation only avoids the collapse because its fixed identity-mass, short-trajectory HMC stays pinned near the theta=0.5 init -- i.e. the published results were computed with theta effectively fixed, never inferred. Hold theta fixed via numpyro.deterministic at pen_args["theta"] (default 0.5, the reference's operating point). samples["theta"], the delta credibility rule, arviz dims and param_names are all unchanged. On the tutorial data this recovers the expected credible effects (Immune, B cells, TA cells) and is stable across seeds and across theta in [0.34, 0.5]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Zethson
added a commit
that referenced
this pull request
Jun 10, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26595dd to
b705184
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
+ Coverage 77.81% 77.90% +0.09%
==========================================
Files 50 50
Lines 6580 6581 +1
==========================================
+ Hits 5120 5127 +7
+ Misses 1460 1454 -6
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #1015 — tascCODA returned zero credible effects on data where it should recover them.
Root cause
The global spike-and-slab mixing weight
theta ~ Beta(1, d)collapses to its prior (median ≈ 0.01) under numpyro NUTS. Because the credibility threshold isa near-zero
thetais a double failure: it shrinksb_tilde = (1-theta)*spike + theta*slabtoward the spike (≈0) and sendsdelta → ∞. Nothing can clear the threshold.This is the model's true marginal posterior, not a numpyro bug. A single global
thetagates a high-dimensional slab, so the low-thetafunnel mouth (slab unconstrained) carries almost all the marginal volume — confirmed by Betancourt's incomplete-reparameterization result: no practitioner-applicable reparameterization changestheta's marginal, and the slab is already non-centered.Why upstream "works": the reference TFP implementation samples with a fixed identity mass matrix and a fixed 10-leapfrog trajectory started at
theta = 0.5, so it physically cannot traverse to the funnel and stays pinned near init (back-solving its reportedDelta = 0.066givestheta ≈ 0.34). numpyro NUTS (adaptive mass + dynamic trajectories) mixes well enough to find the genuinely-collapsed posterior. In other words, the published results were computed withthetaeffectively fixed, never inferred — and the canonical spike-and-slab LASSO (Ročková–George) is itself estimated by MAP/EM precisely because full-Bayes MCMC on this posterior is multimodal/prohibitive.Fix
Hold
thetafixed vianumpyro.deterministicatpen_args["theta"](default 0.5, the reference's operating point; settable, e.g.0.34to match upstream's exactdelta).This is the minimal change that reproduces the paper's effective behavior. Unchanged:
samples["theta"](still present, as a constant), thedeltacredibility rule, the summary layout, arviz dims/coords, andparam_names. The now-deadd = D*(T - n_ref)and the stalethetainit entry are removed.Validation (tutorial data,
formula="Health",phi=0, automatic reference)pen_args)Stable across seeds {0, 7, 42, 123} and across θ∈[0.34, 0.5];
deltais finite. The recovered set matches the effects reported in the issue.Trade-off / faithfulness
thetais no longer a random variable. That is a deliberate, documented deviation from the generative model — but it is faithful to the published results, which depend onthetastaying near 0.5. Keepingthetasampled and instead crippling the numpyro sampler to mimic upstream's non-convergence would be fragile and init-dependent; a regularized-horseshoe redesign would be robust but is a different method (notheta/delta).