Math from Finland, yes, it's fast: FastICA by alexs1320

View this thread on steempeak.com
· @alexs1320 · (edited)
$33.66
Math from Finland, yes, it's fast: FastICA
If you have missed the great series of posts devoted to [Astrophotography](https://steemit.com/steemstem/@terrylovejoy/guide-to-basic-astrophotography-9) (by @terrylovejoy) consider to read them even if you are unrelated to astrophotography.
The latest post was about the noise reduction in stacked images and this inspired me to write about the method for component analysis.

Here is the link to [FastICA](https://www.mathworks.com/matlabcentral/linkexchange/links/2115-the-fastica-package-for-matlab) Toolbox for Matlab. If you want to use it for images, simply convert them to vectors. **Keep in mind that the resolution can't be too high**. 

## If you want to win, hire a Finn
-------------
This is a very true expression in motorsport, as the names like Vatanen, Salonen, Kankkunen, Mäkinen, Hakkinen became immortal.

<center> ![](https://steemitimages.com/DQmV3czXDTNwHPVHegB38d72BFC3p3e4LYnEu4exPqX9mCw/image.png)
 </center>
<center> [Lancia Delta](https://en.wikipedia.org/wiki/Martini_Racing) in Martini colors, from [Wiki](https://en.wikipedia.org/wiki/Martini_Racing#/media/File:Lanciaq_delta_16v_biasion.jpeg), CC-3.0. It has absolutely nothing common to this post, but it looks cool </center>

Our "Math Finn" for today is [**Aapo Hyvärinen**](https://www.cs.helsinki.fi/u/ahyvarin/papers/fastica.shtml), the man behind the FastICA algorithm (*ICA = Independent Component Analysis*).

## The aim of ICA
------------
The algorithm came as the solution of the "cocktail party problem". Imagine that you are at the cocktail party where all the folks are chatting, laughing and there is some music playing from the speakers.

What you hear would be the summation of each individual source of the sound, multiplied by some scalar value that would be the equivalent of the "volume". Mathematically represented, this will be the system of linear equations, something like this: ![](https://steemitimages.com/DQmUgNPpUitSnPsKoSH4JRK4Q6P6h8cw4YjbZYRSyQmnxFR/image.png). x is the signal we are picking up, the sum of all individual sources (s) multiplied by their amplitudes (a).

If the *s* is known or *a* - it's the simplest possible thing to do, but in this case, we know nothing *a priori*. 
This situation is known as the BSS, or the *blind source separation*.

And the tricky part is that *a* and *s* are directly connected. If you made the mistake and give the wrong estimates for the source signals, their relative contributions will be wrong and vice-versa. 

## But how is this even possible?
--------
Well, the idea is to find how exactly are the different sources are statistically independent. 

You have probably heard about the FB scandal and the "new discoveries" (not new at all...) that there are 5 types of people. Or you heard Jordan Peterson saying that it's "multivariate" phenomenon.

Those things are very similar, so similar that the starting equation is the same for those methods (principal component analysis or factor analysis) and ICA: ![](https://steemitimages.com/DQmRtSkkPdDCjeWrPypXddMMdGf2w1Fn1tTdgbZF1j6EdaM/image.png). For non-math people, this is **bold** and it means we are speaking about the matrices (Tables). There will be the results of measurements (**x**), decomposed to "concentrations" (contributions, intensities...), **A** and source components (**s**).

The assumptions is that: **sources (s) are statistically independent and that those components have non-Gaussian distribution**

Why is this good? Because the noise is (mostly) Gaussian. Thus the ICA is good in observing something exceptional. And it's very robust for the analysis of the noise signals (in contrast to PCA/FA that want the F1 track smoothness of the data). Another difference is that ICA components are not the "first", "second"... but all of them are equally important.

However, it is **not perfect for the sparse signals!**.

<center> ![](https://steemitimages.com/DQmQyVZro5DSsg3W555Dx9cYMajVQwXxUEn8Tpz8kAFihXr/image.png)</center>
<center> Mika Hakkinen, from [Wiki](https://fr.wikipedia.org/wiki/Fichier:Mika_Hakkinen_1999_Canada.jpg). PCA/FA require the perfectly smooth input data because those techniques are based on correlation, while the ICA can handle the rally-style dirt full of noise, because the assumption is that the components have non-Gaussian distribution </center>

And there is yet another problem with ICA: because the unit variance is assumed to be 1, the sign could be either + and - because the *s* was squared.

**If your components are strictly positive, consider using the NMF instead.**

## Defining the Independence
-----------
If two variables are uncorrelated - their covariance is zero: ![](https://steemitimages.com/DQmNNeX9bESthHSxai7zdf8Rtx4tunA7x6UpaNaP8k2So7E/image.png)

Now you can easily understand why the components **With Gaussian** distribution are considered to be a noise for ICA. 
Because it's symmetric, and no matter what you do, you can't transform such data into something independent.

https://www.youtube.com/watch?v=1ei4ZLyHzqg
Mika Hakkinen is making doughnuts. Check the paragraph above to see why is this such a great nerdy joke.

But wait, according to the [Central Limit Theorem](https://en.wikipedia.org/wiki/Central_limit_theorem), mixed components will make some Gaussian-like distribution? 

Right, and the (most likely) solution with the ICA logic is to choose the least Gaussian solution for the mixing matrix.

You can choose between the various options, but the measures inculde: kurtosis, negentropy, mutual information, maximum likelihood... The best way to do is to test with your own data.

## Practical application:
--------
Probably the "most classic" application of ICA is for the analysis of [EEG](https://www.sciencedirect.com/science/article/pii/S0957417410005695). For FTIR it's so-so, not the perfect solution, but it works [sometimes](https://link.springer.com/article/10.1007/s10661-011-2400-4). 

**And it's solid for image analysis**, [link](https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q=ICA+image+denoising&btnG=)


## References:
----------
* Easy to understand 30-page tutorial, [link](http://cis.legacy.ics.tkk.fi/aapo/ps/NN00.pdf)
* And the colossal 500-page book, devoted to ICA, [link](https://www.cs.helsinki.fi/u/ahyvarin/papers/bookfinal_ICA.pdf)
* Personal page of Aapo Hyvärinen, with publications, [link](https://www.cs.helsinki.fi/u/ahyvarin/papers/fastica.shtml)
* there is a mistake, find it and win 1 SBD, (@lemouth 's style ;) )

### <center> Write some funny comments </center>
<center> [![](https://steemitimages.com/DQmY1vq5q5qCvMsvcJvi6CX5XdT9docKq3C4hGRd99Adpab/image.png)](https://steemit.com/trending/steemstem) </center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 61 others
properties (23)
post_id47,209,839
authoralexs1320
permlinkmath-from-finland-yes-it-s-fast-fastica
categorysteemstem
json_metadata"{"links": ["https://steemit.com/steemstem/@terrylovejoy/guide-to-basic-astrophotography-9", "https://www.mathworks.com/matlabcentral/linkexchange/links/2115-the-fastica-package-for-matlab", "https://en.wikipedia.org/wiki/Martini_Racing", "https://en.wikipedia.org/wiki/Martini_Racing#/media/File:Lanciaq_delta_16v_biasion.jpeg", "https://www.cs.helsinki.fi/u/ahyvarin/papers/fastica.shtml", "https://fr.wikipedia.org/wiki/Fichier:Mika_Hakkinen_1999_Canada.jpg", "https://www.youtube.com/watch?v=1ei4ZLyHzqg", "https://en.wikipedia.org/wiki/Central_limit_theorem", "https://www.sciencedirect.com/science/article/pii/S0957417410005695", "https://link.springer.com/article/10.1007/s10661-011-2400-4", "https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q=ICA+image+denoising&btnG=", "http://cis.legacy.ics.tkk.fi/aapo/ps/NN00.pdf", "https://www.cs.helsinki.fi/u/ahyvarin/papers/bookfinal_ICA.pdf", "https://steemit.com/trending/steemstem"], "users": ["terrylovejoy", "lemouth"], "tags": ["steemstem", "mathematics", "teamserbia", "fastica", "puzzle"], "app": "steemit/0.1", "image": ["https://steemitimages.com/DQmV3czXDTNwHPVHegB38d72BFC3p3e4LYnEu4exPqX9mCw/image.png"], "format": "markdown"}"
created2018-05-06 11:31:45
last_update2018-05-06 16:49:09
depth0
children7
net_rshares7,291,965,145,402
last_payout2018-05-13 11:31:45
cashout_time1969-12-31 23:59:59
total_payout_value26.202 SBD
curator_payout_value7.456 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length6,671
author_reputation149,050,464,338,619
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (125)
@terrylovejoy ·
$0.06
Thank you for the shoutout @alexs1320 !  I had to go away and think about how this would be applied to image processi  ng (for astronomical images of course) and there could be some interesting applications to explore.  From what I read this is a technique of estimating the original contributions of multiple signals embedded in a single signal.  I will definitely keep this and your links bookmarked!
👍  
properties (23)
post_id47,351,538
authorterrylovejoy
permlinkre-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180507t085604484z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "users": ["alexs1320"], "tags": ["steemstem"]}"
created2018-05-07 08:56:06
last_update2018-05-07 08:56:06
depth1
children1
net_rshares12,289,634,901
last_payout2018-05-14 08:56:06
cashout_time1969-12-31 23:59:59
total_payout_value0.041 SBD
curator_payout_value0.014 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length402
author_reputation14,677,992,676,220
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@alexs1320 ·
(Probably) the best algorithm would be the SOBI-RO from the package ICALAB, by Andrzej Cichocki. That obscure method works with everything I've ever put as the input. It's especially good for sparse signals.

In your case, the workflow would be: each image --> image to vector (in Matlab) --> all the vectors packed into the input matrix --> SOBI-RO --> back to images (vector to matrix) --> and... see what is the signal and what is the noise :) --> discard the noise 

From *n* images, *n* components could be extracted (both in ICA and SOBI), in contrast to PCA/FA where you need *2n+1* starting signals for only *n* components,
properties (22)
post_id47,357,136
authoralexs1320
permlinkre-terrylovejoy-re-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180507t094617112z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "tags": ["steemstem"]}"
created2018-05-07 09:46:21
last_update2018-05-07 09:46:21
depth2
children0
net_rshares0
last_payout2018-05-14 09:46:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length631
author_reputation149,050,464,338,619
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@lemouth ·
$0.06
Ooohhh.... I didn't find the mistake.... Except if it is connected to 2=0. Otherwise, things may get weirdly uncorrelated...

I liked the choice of illustrations btw :)
👍  
properties (23)
post_id47,359,220
authorlemouth
permlinkre-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180507t100655053z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "tags": ["steemstem"]}"
created2018-05-07 10:06:57
last_update2018-05-07 10:06:57
depth1
children3
net_rshares12,289,634,901
last_payout2018-05-14 10:06:57
cashout_time1969-12-31 23:59:59
total_payout_value0.056 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length168
author_reputation178,283,483,453,967
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@alexs1320 ·
Winner!
properties (22)
post_id47,359,316
authoralexs1320
permlinkre-lemouth-re-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180507t100751963z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "tags": ["steemstem"]}"
created2018-05-07 10:07:51
last_update2018-05-07 10:07:51
depth2
children2
net_rshares0
last_payout2018-05-14 10:07:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length7
author_reputation149,050,464,338,619
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@terrylovejoy ·
Yes covariance =  0, not 2, good spot @lemouth !
👍  
properties (23)
post_id47,372,995
authorterrylovejoy
permlinkre-alexs1320-re-lemouth-re-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180507t115851429z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "users": ["lemouth"], "tags": ["steemstem"]}"
created2018-05-07 11:58:51
last_update2018-05-07 11:58:51
depth3
children0
net_rshares3,814,042,947
last_payout2018-05-14 11:58:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length48
author_reputation14,677,992,676,220
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries
0.
weight500
accountminnowsupport
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@lemouth ·
Ohhh.. I was not expecting this to be the stuff to find :D
properties (22)
post_id47,487,589
authorlemouth
permlinkre-alexs1320-re-lemouth-re-alexs1320-math-from-finland-yes-it-s-fast-fastica-20180508t040736399z
categorysteemstem
json_metadata"{"app": "steemit/0.1", "tags": ["steemstem"]}"
created2018-05-08 04:07:36
last_update2018-05-08 04:07:36
depth3
children0
net_rshares0
last_payout2018-05-15 04:07:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length58
author_reputation178,283,483,453,967
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steemitboard ·
Congratulations @alexs1320! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/payout.png)](http://steemitboard.com/@alexs1320) Award for the total payout received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click [here](https://steemit.com/@steemitboard)

If you no longer want to receive notifications, reply to this comment with the word `STOP`

> Upvote this notification to help all Steemit users. Learn why [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
properties (22)
post_id47,466,182
authorsteemitboard
permlinksteemitboard-notify-alexs1320-20180508t003939000z
categorysteemstem
json_metadata"{"image": ["https://steemitboard.com/img/notifications.png"]}"
created2018-05-08 00:39:39
last_update2018-05-08 00:39:39
depth1
children0
net_rshares0
last_payout2018-05-15 00:39:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length682
author_reputation38,705,954,145,809
root_title"Math from Finland, yes, it's fast: FastICA"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000