# Shannon's ICA rank project

This is the EEGLAB Wiki page for Shannon's ICA rank project supported by Makoto. This is the first open project for EEGLAB mailing list.

## May 2021 Update

### The description of the problem

Sometimes our infomax ICA in runica() fails in a weird way. One of such examples can be seen here [1]. Henceforth, we refer to this weird IC as a ghost IC.

### The cause of the ghost IC (07/16/2021 updated)

The ghost IC is caused by running ICA on rank-deficient data. To make matters worse, even if the data is not exactly rank deficient, when the smallest eigenvalue is smaller than some threshold value, such as 1E-7, it causes the same issue. The very small, practically near-zero eigenvalue means two lines are not exactly in parallel but very close to parallel anyway. This is a typical ill-conditioned setup. Although Matlab rank() can calculate the smallest eigenvalue up to 1E-16, our ICA algorithm starts to fail from around 1E-7 (the exact number needs is unknown; one of the goals of the current study). This is why using Matlab rank() to count the number of eigenvalues does not work. Instead, we should rather evaluate the smallest eigenvalue of the data. In the language of linear algebra, the problem is described as follows. The condition number $\frac{\sigma_{max}(A)}{\sigma_{min}(A)}$, where $\sigma_{max}(A)$ is the maximum singular value of $A$ and $\sigma_{min}(A)$ is the minimum singular value of $A$. The larger the condition number is, the more ill the data is and close to singularity, suggesting more likely for ICA to fail.

There are at least three known scenarios at this point in which ghost ICs appear.

1. Applying average referencing: This process either reduce rank by 1 (without including the initial reference) or does not cause rank reduction but make the smallest eigenvalue moderately small (about 1/100 compared with the original data in one case)
2. Applying spline interpolation after bad channel removal: Because the spline interpolation is a non-linear process, rank reduction does not happen but makes the smallest eigenvalue dangerously small (about 10^-9 or 1/1000000000 compared with the original data in one case)
3. 'Bridged' electrode (i.e. shorted) by conductive gel: This is the case that the recorded data is originally rank deficient. The 'bridged' electrodes should show an identical signal in the two (or more) channels (Thanks Cedric Cannard for the input!)

By the way, artifact subspace reconstruction (ASR) will also fail if input data is not full-ranked!

### The current solution

To avoid instability, the variable “rankTolerance = 1e-7” is set in pop_runica() to hard-code the smallest acceptable value of . However, this solution remains unvalidated for a long time, and apparently fails from time to time!

### The goal of the project

Our goal are twofold.

1. To determine the lower bound of the ICA’s tolerance to the small eigen value before it begins to fail. Also, we are interested in confirming signatures when ICA fails.
2. To propose a parameter based on our investigation using simulation and empirical data.