# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Decompose a matrix into Independent Component Analysis matrix factors

Contributed by:
Anton Antonov

ResourceFunction["IndependentComponentAnalysis"][ decomposes the matrix | |

ResourceFunction["IndependentComponentAnalysis"][ decomposes |

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 *mat* can be a square or rectangular matrix.

The columns of *mat* are interpreted as signals.

ResourceFunction["IndependentComponentAnalysis"] accepts the following options:

"InitialUnmixingMatrix" | Automatic | initial un-mixing matrix |

"NegEntropyFactor" | 1 | negative entropy factor |

"NonGaussianityFunction" | Automatic | non-Gaussianity measure function |

"RowNorm" | False | whether to normalize the matrix rows at each step |

MaxSteps | 200 | maximum steps of the ICA interation process |

PrecisionGoal | 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.

Here is a random integer matrix:

In[1]:= |

Out[3]= |

Here are the Independent Component Analysis matrix factors:

In[4]:= |

Out[4]= |

Here is the matrix product of the obtained factors:

In[5]:= |

Out[8]= |

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

In[9]:= |

Plot the values:

In[10]:= |

Out[10]= |

Compute the ICA matrix factors:

In[11]:= |

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

In[12]:= |

Out[12]= |

Here is the relative error for the first three columns:

In[13]:= |

Out[13]= |

Here are comparison plots:

In[14]:= |

Out[14]= |

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[15]:= |

Plot the results:

In[16]:= |

Out[16]= |

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[17]:= |

Plot the results:

In[18]:= |

Out[18]= |

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*).

Here are signal generating functions:

In[19]:= |

Here is a mixing matrix:

In[20]:= |

Form a matrix of the signals:

In[21]:= |

Out[21]= |

Plot the values:

In[22]:= |

Out[22]= |

Create and plot the mixed signals matrix:

In[23]:= |

Out[23]= |

Find the ICA decomposition:

In[24]:= |

Approximation norm:

In[25]:= |

Out[25]= |

Visualize the ICA-identified source signals:

In[26]:= |

Out[26]= |

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[27]:= |

Out[27]= |

Here we apply ICA to the new mixed signals:

In[28]:= |

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

In[29]:= |

Out[29]= |

- fastICA: FastICA Algorithms to Perform ICA and Projection Pursuit–CRAN
- Independent component analysis for multidimensional signals–Mathematica for Prediction
- antononcube GitHub–IndependentComponentAnalysis

- 1.0.0 – 18 November 2019

This work is licensed under a Creative Commons Attribution 4.0 International License