Conversation
Codecov Report
@@ Coverage Diff @@
## master #5253 +/- ##
==========================================
+ Coverage 88.13% 88.13% +<.01%
==========================================
Files 358 358
Lines 65820 65875 +55
Branches 11206 11210 +4
==========================================
+ Hits 58008 58061 +53
- Misses 4985 4987 +2
Partials 2827 2827 |
|
@agramfort can you check and see if you agree this could be useful? If so I'll finish. If not then I'll try to make a more compelling case before getting into the rest of the cleanup steps. |
|
can you show me quantified evidence of the gain you observed? sorry if you already did but I find no trace of it. |
| ('epochs_reg', proj_epochs_reg, [0.00, 0.01], [0.9, 0.95]), # bad | ||
| ('evoked', proj_evoked, [0.2, 0.3], [0.97, 0.99]), # better | ||
| ('xdawn', proj_xdawn, [0.2, 0.3], [0.15, 0.2]), # better | ||
| ('xdawn_reg', proj_xdawn_reg, [0.3, 0.4], [0.01, 0.03])): # best |
There was a problem hiding this comment.
@agramfort here, first pair of numbers are bounds on inner product with the desired artifact (with human readable interpretation comments)
There was a problem hiding this comment.
ping @agramfort to see if this makes sense to you
|
I only skimmed over this, but the idea is to take the ExG events and model them as "ERP" events with XDawn? |
|
Yeah |
|
Interesting. Have you benchmarked the 3+ different versions of the same algorithm we have here? You could presumably also do it with the encoder module, or |
|
I have not, my assumption was that they were roughly equivalent |
|
@jona-sassenhagen do you expect rERP / XDawn to give a better estimate for removal? What is the best test case to show it? I've tried to come up with one here but it's not entirely convincing. |
|
It depends on what you need - if you only need the encoding models, rERP might be faster. If you need the stuff beyond that, you got to use XDawn anyways. |
|
My question is more: how do we show that, say, the ECG waveform estimated using Xdawn (or rERP) is better than that obtained by the simple trial average? Under what conditions is it better? |
|
... If it only happens when events overlap -- like I suspect might be the case for rERP? -- then it's not so useful for EOG / ECG. I think Xdawn has an additional noise-suppression step (the |
|
Hm, I may still be missing what you're saying. The regression-based approach and averaging are the same if no overlap is present. You actually helped me write the CI test where we test that :) But I could imagine the overlap correcting actually helps? The part of XDawn after the regression, i.e., mne-python/mne/preprocessing/xdawn.py Line 175 in 04c6256 |
For blinks maybe, but likely only in cases of a lot of blinking (i.e., rare). For ECG, I hope the complexes do not typically overlap. :) So then the noise cancellation |
Well then it depends on the length of the window, right? If one epoch captures both the beginning of the next and the end of the preceding one, ... |
|
Btw small note, I used cupy's dot products and linalg.solve for the solver yesterday and it gave me approx a 5x speed increase for the ridge here. So it might in principle be worth investigating that for all linear regressions we use. I'm sure it wouldn't even be hard to use skcuda.linalg here. |
|
There are many linalg operations that slow us down. It would be great to try replacing some of them. There was no suitable replacement when I looked a couple of years ago. |
|
cupy is in many ways as drop-in as it works -- as evidenced by the fact that even I can use it. Check it out: https://cupy.chainer.org A sparse X, dense Y solver is just: And this is cool: I.e., write generic functions that chose cupy/CUDA or numpy as the backend depending on the input. |
agramfort
left a comment
There was a problem hiding this comment.
could you illustrate this in an example ? do the projs look visually different in sample? what was the motivation for this? did you observe in one dataset that plain SSP was failing?
| @@ -284,7 +317,9 @@ def compute_proj_eog(raw, raw_event=None, tmin=-0.2, tmax=0.2, | |||
| h_freq : float | None | |||
| Filter high cut-off frequency for the data channels in Hz. | |||
| average : bool | |||
Not that different from
If it's better to use Xdawn than SSP to find signals of interest, it should be better at finding artifacts of interest, too.
Originally I did, but I was using |
|
A meta-argument: it's probably good to set up MNE highly modular - so that it is possible to exchange one encapsulated part of a pipeline with another. So ideally, given that Xdawn is already in, it should be very low cost to hook it in here. |
|
> But perhaps it's not worth adding Xdawn in more places (like artifact
processing) until we find a really convincing use case? Or maybe it's not
so useful for artifacts that have high "SNR" anyway?
I would say so unless we get clear empirical evidence
Jona we add a tiny opinion we make any refactoring and adding new features
harder. Let's not add features become we can. I think we have more burning
issues that are actually preventing people from doing their analysis with
MNE.
And if we have spare cycles working on the doc is much appreciated. I hear
still a lot that our doc is hard to grasp and often too scattered across
files.
|
|
Okay let's close this one and if there is some problematic use case in the future we can see if it works better |
Adding
xdawnas a way to compute projectors.Currently has a test showing superior performance via regularization. Also unifies approaches to computing covariance.
Todo:
compute_proj_epochscompute_e*g_projsassert_raises)whats_new.rstCloses #5148.