Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Decompose a matrix into Independent Component Analysis matrix factors
ResourceFunction["IndependentComponentAnalysis"][mat,k] decomposes the matrix mat into k components. | |
ResourceFunction["IndependentComponentAnalysis"][mat,k,opts] decomposes mat using the options opts. |
"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 |
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]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License