Repository navigation
WIP, ENH: Be verbose if fitting ICA on rank-deficient data - #8313
Closed
hoechenberger wants to merge 1 commit into
Closed
hoechenberger wants to merge 1 commit into
hoechenberger wants to merge 1 commit into
Conversation
@agramfort and I encountered a weird, seemingly inexplicable issue when using ICA for EOG and ECG artifact correction. Turned out – the only reason that lead us to "waste" several hours was simply that the input data was rank-deficient, because it had 3 SSP projection vectors in `.info`. I have therefore opted to enhance `ICA.fit()` such that it would (hopefully) detect such cases in the future, and voice its concerns or even fail hard. I have added a `check_rank=True` kwarg to `ICA.fit()`. If `True` (default), the user will get an extensive warning if the rank of the data is expected to be NOT full even after the PCA step. The error message will contain concrete directions what to do. My idea is that this message, for now, remains a warning, and will change to an `Exception` with 0.23 the latest. In fact, I'd prefer if we immediately made it an exception, because I think we should fail hard in this case; but I assume other devs would be against this, therefore we should probably do a deprecation cycle. If the user passes `check_rank=False`, we will still produce a warning, but it won't be as extensive. My idea was just such that one doesn't accidentally leave `check_warn=False` in the code after testing something and forgetting about it. Once `check_rank=True` raises an exception, the behavior difference between `check_rank=True` and `check_rank=False` will become more clear.
Member
Author
|
Voice call with @agramfort:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@agramfort and I encountered a weird, seemingly inexplicable issue when using ICA for EOG and ECG artifact correction. Turned out – the only reason that lead us to "waste" several hours was simply that the input data was rank-deficient, because it had 3 SSP projection vectors in
.info.I have therefore opted to enhance
ICA.fit()such that it would (hopefully) detect such cases in the future, and voice its concerns or even fail hard.I have added a
check_rank=Truekwarg toICA.fit(). IfTrue(default), the user will get an extensive warning if the rank of the data is expected to be NOT full even after the PCA step. The error message contains concrete directions on what to do.My idea is that this message, for now, remains a warning, and will change to an
Exceptionwith 0.23 the latest. In fact, I'd prefer if we immediately made it an exception, because I think we should fail hard in this case; but I assume other devs would be against this, therefore we should probably do a deprecation cycle.If the user passes
check_rank=False, we will still produce a warning, but it won't be as extensive. My reasoning behind this is that it helps ensure that one doesn't accidentally leavecheck_rank =Falsein the code after testing something and forgetting about it. Oncecheck_rank=Trueraises an exception, the behavior difference betweencheck_rank=Trueandcheck_rank=Falsewill become more clear.Todo: