# Function Repository Resource:

# IndependentComponentAnalysis

Decompose a matrix into Independent Component Analysis matrix factors

Contributed by: Anton Antonov
 ResourceFunction["IndependentComponentAnalysis"][mat,k] decomposes the matrix mat into k components. ResourceFunction["IndependentComponentAnalysis"][mat,k,opts] decomposes mat using the options opts.

## Details and Options

The Independent Component Analysis (ICA) is a matrix factorization method that utilizes Gram–Schmidt orthogonalization by considering two vectors (two signals) to be orthogonal if their difference is Gaussian white noise.
The argument matrix can be square or rectangular.
The columns of the argument matrix are interpreted as signals.
Here are the options taken by ResourceFunction["IndependentComponentAnalysis"]:
 "InitialUnmixingMatrix" initial un-mixing matrix "NegEntropyFactor" 1 negative entropy factor "NonGaussianityFunction" non-Gaussianity measure function "RowNorm" whether to normalize the matrix rows at each step 200 maximum steps of the ICA interation process 6 precision goal
For some data, at least several executions are required in order to get components that provide satisfactory interpretation.
The negative entropy factor is specified with the option "NegEntropyFactor". The negative entropy factor controls how aggressively ICA learns from the "landscape" produced by the non-Gaussianity measure function (specified with "NonGaussianityFunction").
The function ResourceFunction["IndependentComponentAnalysis"] uses SingularValueDecomposition internally.

## Examples

### Basic Examples

Here is a random integer matrix:

 In:= Out= Here are the Independent Component Analysis matrix factors:

 In:= Out= Here is the matrix product of the obtained factors:

 In:= Out= ### Scope

Here is a random matrix with its first two columns having much larger magnitudes than the rest:

 In:= Out= Compute the ICA matrix factors:

 In:= Here is the relative error of the approximation by the obtained matrix factorization:

 In:= Out= Here is the relative error for the first three columns:

 In:= Out= Here are comparison plots:

 In:= Out= ### Options

#### InitialUnmixingMatrix

Using the option "InitialUnmixingMatrix", we can influence the results by providing initial un-mixing matrix for ICA's iteration process. Here we compute ICA with different initial un-mixing matrices:

 In:= Here we plot the results:

 In:= Out= #### NonGaussianityFunction

ICA is essentially a Gram–Schmidt process that considers two signals to be orthogonal if their difference is Gaussian noise.

Here we compute ICA with different non-Gaussianity measure functions:

 In:= Plot the results:

 In:= Out= Note that we used a small number of steps in order to obtain similar but different results. Using a sufficiently large number of steps (say, 20) we get almost the same results (with the matrix mat).

### Applications

#### Blind signal separation

Here are signal generating functions:

 In:= Here is a mixing matrix:

 In:= Form a matrix of the signals:

 In:= Out= In:= Out= Create the mixed signals matrix:

 In:= Out= Find the ICA decomposition:

 In:= Approximation norm:

 In:= Out= Visualize the ICA-identified source signals:

 In:= Out= ### Possible Issues

#### Outliers presence sensitivity

The ICA computations can be sensitive to the presence of outliers. Here we add a small number of outliers to the original mixed signals:

 In:= Out= Here we apply ICA to the new mixed signals:

 In:= We see that the found components are not that good compared to the components found for the original mixed signals data:

 In:= Out= 