-
Notifications
You must be signed in to change notification settings - Fork 14
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
MRG: Clean-up and add comparison/all implementations for feature extraction #18
Conversation
…w smaller test files
Whoot! Nice @mscheltienne if it matches, that's exciting news. This is a large diff, so I'll take some time soon to do an in-depth review. @jacobf18 and @anandsaini024 should sanity check as well.
Hmm so my opinion is that if it's happening in EEGLab, it's a "bug" but solely on their end. We simply want to match the EEGLab's first pipeline run (before saving the data to disc). Basically, I think it's fine. A quick question, so if we re-reference to average multiple times it shouldn't change right? Perhaps misunderstanding, but why does |
I will review tonight if possible. Some spelling mistakes and missing items to add to the MANIFEST file from the CI.
Perhaps |
I should have pinged after writing this comment 😅 That covers it entirely. I think it's as close as it gets, and this test suit will be a good base for any further improvement. The code here does not focus on efficiency but focuses on reproducing the MATLAB output. Any improvement that does not fail the test will maintain equivalence with MATLAB. For the common average reference, as said the feature extraction starts with:
which is buggy for the following reasons:
-> IMO, those are several bugs on the EEGLAB side, so let's just assume that we have a dataset that is referenced with a CAR. For all the tests, I've changed the field Note that if you call The code here assumes that all the channels have been provided to the ICA. I did not implement the
It would be nice to test this on a couple of datasets where we also look at the component to make sure the output looks correct. |
For the Let me know if the previous comment answers your question for the CAR issue. |
mne_icalabel/tests/test_features.py
Outdated
assert len(set(list(subset_eeglab[0, :] - 1)).difference(set(list(subset)))) == 0 | ||
|
||
|
||
def test_eeg_rpsd_compute_psdmed(): |
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.
It seems we don't need this extra test given the below test_eeg_rpsd
(?)
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.
Fine by me, the only added information was that if only test_eeg_rpsd
fails, then the problem lies within _eeg_rpsd_format
. But that is not worth an additional test and can be debugged on the fly if test_eeg_rpsd
ever fails.
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.
Awesome refactor and sprint @mscheltienne !
It looks great to me. Just a few minor changes to maybe make things easier to maintain down the line.
Perhaps the next step is to tidy up the example
with a bunch of different simulations and also tests on real sample data from MNE-Python.
Co-authored-by: Adam Li <adam2392@gmail.com>
I am getting an error with |
Sorry the make recipe only "checks" for formatting errors. You'll need to run "black ." I think I can fix that in another PR to make the dev exp easier. |
I am really exhausted today... why the hell am I typing |
Sorry... just noticed that. I've previously set it up to just format it. |
@jacobf18 and @anandsaini024 skim the changes to see if you spot any issues. Meanwhile ill merge this. |
Hey! @jacobf18 @adam2392 @anandsaini024
Seeing all the good progress made, I wanted to finalize the first big step of this project: a completely tested and similar port of the network and features in Python. In this PR:
Progress:
For each, I replicated as close as possible the MATLAB outputs and added the corresponding tests to compare the data arrays. Contrary to your code @jacobf18 that I used, I did not change the shapes and instead matched the shapes from MATLAB to simplify testing and comparison.
And finally, the ICLabel feature extraction function differs depending on:
So I added test files for each scenario:
-epo
for epochs-raw
for raws (above 5 secs)-short-raw
for raws (1 to 5 secs)-very-short-raw
for raws (0 to 1 sec)Side note: