[ENH] StatsModels: Add invalid_inputs parameter to allow dropping of missing data columns to run nodes#1145
Merged
effigies merged 3 commits intobids-standard:masterfrom Sep 23, 2025
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1145 +/- ##
==========================================
- Coverage 89.40% 89.25% -0.16%
==========================================
Files 66 66
Lines 7252 7258 +6
Branches 1145 850 -295
==========================================
- Hits 6484 6478 -6
- Misses 559 571 +12
Partials 209 209 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
effigies
approved these changes
Sep 23, 2025
effigies
added a commit
that referenced
this pull request
Sep 24, 2025
Version 0.20.0 (September 24, 2025) New feature release in the 0.20.x series. This release finalizes some deprecations that were started in the 0.7 and 0.14 series. In particular, passing indexer arguments to ``BIDSLayout`` and disabling ``absolute_paths`` mode in ``BIDSLayout()`` or ``BIDSLayout.get()`` will now error. To adjust indexing behavior, create an explicit ``BIDSLayoutIndexer()`` and pass ``BIDSLayout(..., indexer=indexer)``. To access relative paths, use the ``BIDSFile.relative_path`` property on ``BIDSLayout.get()`` return values. * FIX: Check for attribute that can be absent before assigning (#1165) * FIX: Accommodate deprecations in the upcoming Pandas 3 release (#1173) * FIX: Repaired convolution issue that arises when onset values are repeated (#1133) * ENH: StatsModels: Add `invalid_inputs` parameter to allow dropping of missing data columns to run nodes (#1145) * ENH: Add missing root-level path patterns (#1169) * ENH: Parse ``seg-`` entities from dseg or probseg files (#1172) * DOC: Update link to derivatives config file (#1132) * MNT: Address warnings produced by pybids and dependencies (#1136) * MNT: Lock test environment, update with dependabot (#1134)
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.
BIDSStatsModelsNode.run()gracefully drops missing contrasts wheninvalid_contrasts=="drop", but missing data columns in the GLM at the run level (entries ofModel.X) currently always throw an error. As far as I can tell, this makes it impossible to useBIDSStatsModelsNode(and BIDS apps that depend on it, like fitlins) for tasks in which some conditions do not appear in some runs (a use case I happen to have at the moment, which also seems to pop up for others, e.g., here and here). This PR adds aninvalid_inputsparameterBIDSStatsModelsNode.run()andBIDSStatsModelsNodeOutput.__init__()that permits a"drop"value just likeinvalid_contrasts, which warns about missing data columns and then removes them fromvar_names. I've tested this modification withfitlinsand it appears to give the desired enhancement: individual runs estimate all and only the available contrasts (and missing contrasts at downstream nodes are then handled by the existinginvalid_contrastsfeature). I've set the default value ofinvalid_inputsto"error", so that the previous default behavior remains unchanged.