mne-tools / mne-tools/mne-python
ENH: refactor Xdawn and linear_regression_raw
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.5k
- Forks
- 1.6k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 100
Description
Xdawn and linear_regression_raw overlap a lot. Both use toeplitz to construct a big predictor matrix from event arrays, and return the coefficients of regressing the brain data. Possibly, linear_regression_raw could be extended slightly to function as a backend for Xdawn, as discussed with @alexandrebarachant .
The main issues:
- Xdawn has an option to return the predictors, although it's not used within the function I think.
- linear_regression_raw takes raw input, Xdawn epochs (although it seems the original intent was for Xdawn to take raw too) is probably the most complicated step.
- Allowing Xdawn to call linear_regression_raw, and to read the result, should be straight-forward.
I don't think it would make much sense to refactor in the other direction (use Xdawn as the estimator for linear_regression_raw, or fully lose linear_regression_raw in favour of big Xdawn API enlargement) due to API and usage case differences
Maybe this should wait until #2331 has been addressed though.
@alexandrebarachant
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Xdawn and linear_regression_raw implementations, especially their toeplitz predictor construction, input shapes, and returned coefficients. Review the discussion around #2331 before deciding whether linear_regression_raw can serve as Xdawn's backend; done means the overlap is reduced without breaking the distinct APIs or expected raw and epoch inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100