RF: Simplify variable loading and resampling #2
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.
Attempt to simplify fitting encoding/decoding models. Since the himalaya API is similar to sklearn, I focused on making loading data from Neuroscout API easier.
I implemented a helper function in pyNS, to help fetch predictors from the Neuroscout API and resample them to TR. ENH: Add high-level predictor fetching utilities neuroscout/pyNS#112
The main advantage is that
pybids
already implements densification/resampling logic, and variable alignment. In addition, users could use pybids Transformations on these variables. The downside is the pybids dependency, but it's optional to use this helper.Another nice thing is that this returns a df that also includes indexing info (i.e. subject, run, etc...) which can then be used by whichever downstream CV scheme, etc...
I think my plan with this will be to add this as a pyNS tutorial, but not upstream anything related to himayala/sklearn. Those APIs are already good, so I think as long as we provide the data easily from Neuroscout (both events and preprocessed data), and show a good example, that should be good enough.
Perhaps in the future, I will also work on a full workflow like FitLins (or directly in it!) for encoding/decoding w/ BIDS StatsModels.