Repository navigation
WIP: Warn if ICA was performed on potentially rank-deficient data - #8328
hoechenberger wants to merge 8 commits into
Conversation
Also fixes a bug handling float values
|
@agramfort @larsoner @cbrnr |
|
If #8326 becomes a success, we can also close this PR… |
Do we fit ICA on the data with projectors applied, or not? If it varies, then we can probably compute rank only taking into account projectors marked as "active" (i.e., applied to the data). I imagine most raw instances have not had the projectors applied, and hence shouldn't be counted when computing the rank. |
I'm not sure, would need to step through the code. Does |
Only if And you should be able to check this in a test that uses it just by doing a quick |
|
Ok, sounds good! |
|
@larsoner Also needed to add an option to include EOG channels in rank computation via |
Why? If these channels are included in the ICA, they should be included in the rank calculation, no? We need the ICA to be stable, so if those channels are included in ICA they should affect the rank calculation. |
Yes, exactly. By default on I discovered this because some ICA unit tests that do have an EOG channel started throwing a warning about rank deficiency, because only the M/EEG channels were considered by the rank calculation. I can also revert the last changes that add EOG to rank calculation so you can see for yourself. My current approach of adjusting |
|
@larsoner I've reverted the "EOG changes" so you can see for yourself what the problem was |
|
I'm OK with issuing a warning if we detect rank deficiency. However, the rank needs to be computed on the same data that ICA uses (and not just by assuming certain types of channels). Furthermore, I have never used projectors, so I hope these do not interfere with ICA - if they do (e.g. if projectors are not only available but also active) we should also issue a warning. |
Yes, this is precisely what we're / I'm trying to achieve here :)
If they're applied, each projector will reduce the rank of the data by 1. |
Yes, but at least issue an info. I could imagine myself having applied projectors accidentally, or people might want to compute ICA with the original data even if they have projectors applied. That way, they can at least see what's going on. |
You mean something like ? |
|
Exactly! |
|
@cbrnr Ok, that seems reasonable. @larsoner |
|
IIRC the only reason it's really named |
|
Thanks @larsoner. Are you implying that EOG (and ECG, for that matter) are not data channels?
…Sent from my iPad
On 2. Oct 2020, at 15:42, Eric Larson ***@***.***> wrote:
IIRC the only reason it's really named _estimate_rank_meeg_signals is because typically we only want data channels for noise cov + inversion. I don't see a problem with making it work for other channel types, too -- we just need to make sure our default scaling factors do something reasonable for EOG and ECG channels for example, and that we don't start accidentally returning EOG/ECG in places in the code that currently use that function. This should be fixable via some picking arguments of some sort.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
|
This PR should be updated so that only |
Reference issue
Closes #8313, #8316, #7727
What does this implement/fix?
Additional information
WIP because working on this PR exposed that the default for
max_pca_components, currentlyn_channels, might not be the best choice. Lots of tests fail now because we get the new warning, typically:This is because currently, I calculate rank with SSP projectors applied, so the rank of the data would effectively be
n_channels - len(info['projs']), which is obviously smaller thann_channelsif there is any projection vectors stored.Now this got me thinking, should the default of
max_pca_componentsbe changed fromn_channelston_channels - len(info['projs'])?Applied SSP projectors leading to rank-deficient data and thereby screwing up ICA was exactly the problem @agramfort and I witnessed in the past.