-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project CSP patterns to source #950
base: main
Are you sure you want to change the base?
Conversation
Hey @SophieHerbst, thanks for pinging me via email. |
PS: Cool that you want to add this! :) |
if @larsoner and @hoechenberger agree of course. But to me this is the missing piece I have been looking for in a while to be able to interpret the CSP results. |
👍👍👍👍👍 |
|
||
# COEFS | ||
clf.fit(X, y) | ||
weights_csp = mne.decoding.get_coef(clf, "patterns_", inverse_transform=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically this is all I use. Why also take the csp.patterns_
? csp.fit(X, y)
results anywhere else so it's a bit weird to me to add them here. It seems like we should just use these weights_csp
. And maybe we should call them clf_patterns_
because they're really the patterns inverse transformed from the CSP all the way back through the other steps (e.g., PCA, sensor scaling)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is exactly where I am lost in the terminology..
my approach was to save the weights in this step to pick them up in a separate source projection step later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to save both, because in @britta-wstnr's code they are combined during beamforming:
stc_csp = beamform_components(weights_csp, sensor_pattern_csp, spat_filter,
fwd, multipliers=multiplier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here is to combine the coefficients and the CSP components. The (Haufe et al.) patterns are not easily beamform-able as they do not represent classical sink-source patterns anymore but refer to the decoding classes. Using the CSP components is a work-around for that.
Yes so far I have been projecting inverse-transformed CSP clf |
I think I found it. |
With the above code, I get an error in _05_decoding_csp.py, at csp.fit_transform()
|
I sometimes hit these and try to open issues on the relevant upstream trackers. In this case it's probably an OpenBLAS bug. You can try setting OMP_NUM_THREADS=1 in your env, sometimes it fixes it. In principle using Can you run the pipeline with
and then also do
and upload the |
... there is also a chance that upgrading your OpenBLAS / NumPy could fix the issue. Or switching away from using MKL if you're using it |
... in other words this sounds a lot like OpenMathLib/OpenBLAS#3044 . A couple of other useful outputs would be:
|
Thanks @larsoner I updated numpy and am trying to run it again right now. |
Hello! I am trying to implement Britta's and Jean-Remy's best of both world approach to project the CSP decoding patterns to source.
I am able to do it on my data in my own code, but I am struggling to extract the patterns and coefficients in the pipeline code.
On the one hand, I am a bit lost in the terminology between patterns, coefficients, and filters.
On the other hand, when using Britta's code, I get an error message:
Can you help me understand how I need to change the decoding pipeline to make it work?