You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@hoechenberger not 100% sure this is related to #8313 and #8316 since those seem to have to do with ICA taking too long rather than doing something totally wrong. To me this code should work / be a no-op:
import numpy as np
import mne
data = np.random.RandomState(0).randn(10, 100000)
info = mne.create_info(10, 1000., 'eeg')
raw = mne.io.RawArray(data, info)
raw.set_eeg_reference()
assert np.linalg.matrix_rank(raw.get_data()) == 9
ica = mne.preprocessing.ICA(
max_pca_components=10, n_pca_components=10, max_iter=1, verbose=True)
raw_new = ica.fit(raw).apply(raw.copy())
np.testing.assert_allclose(raw.get_data(), raw_new.get_data())
It seems like this should work even if you get the number of components wrong. It suggests that something is wrong with the mixing/unmixing step that when the number of components equals the number of channels you don't get an identity transform here.
It also fails for max_pca_components=10, n_pca_components=9 but passes for any value of max_pca_components (8, 9, 10) so long as max_pca_components=9.
@hoechenberger not 100% sure this is related to #8313 and #8316
...
It also fails for max_pca_components=10, n_pca_components=9 but passes for any value of max_pca_components (8, 9, 10) so long as max_pca_components=9.
I believe this is related, and in fact may be the true explanation for super bad ICA results @agramfort and I witnessed when working with rank-deficient data (i.e., without setting max_pca_components to an appropriate value)
Reducing the rank always fixed things for us.
This is why I started working on #8321, to make it easier to select a relative number of components (explaining x% of variance).
Commented-out the avg reference step, and the assertion holds…
Yes it's 100% because it's rank deficient. But my point is that if we can make it so that this doesn't blow up the data without any special intervention (such as trying to detect the rank), we should. That's what #8326 does.
Activity
hoechenberger commentedon Sep 30, 2020
I believe this is related, and in fact may be the true explanation for super bad ICA results @agramfort and I witnessed when working with rank-deficient data (i.e., without setting
max_pca_componentsto an appropriate value)Reducing the rank always fixed things for us.
This is why I started working on #8321, to make it easier to select a relative number of components (explaining x% of variance).
hoechenberger commentedon Sep 30, 2020
I think it's really because your data is rank-deficient here thanks to the avg reference.
hoechenberger commentedon Oct 1, 2020
Commented-out the avg reference step, and the assertion holds…
larsoner commentedon Oct 1, 2020
Yes it's 100% because it's rank deficient. But my point is that if we can make it so that this doesn't blow up the data without any special intervention (such as trying to detect the rank), we should. That's what #8326 does.
hoechenberger commentedon Oct 1, 2020
Ok, got it