[R] fastICA package: C, R codes provide vastly different results
Dear friends, I have been trying out the C and the R codes in the fastICA package. However, it turns out that these often give vastly different results, especially when row.norm is set to T. This happens even though I have initialized the input matrix to be exactly the same for both of them. Here is an example: ### cut code here xx - read.table(file = http://maitra.public.iastate.edu/SharadUtshob05.dat;) win - matrix(c(-0.434590, 1.288207, -0.597128, -0.501621, 1.434678, 0.812076, -1.281559, -1.798178, 0.409151), ncol = 3) library(fastICA) adeflate.C - fastICA(X = xx, alg.typ=deflation, row.norm=T, w.init=win, n.comp=3, fun = logcosh, method = C) adeflate.R - fastICA(X = xx, alg.typ=deflation, row.norm=T, w.init=win, n.comp=3, fun = logcosh, method = R) ### end code here. The answers follow: note that the final un-mixing matrix estimate W is not even close to each other. adeflate.R$W [,1] [,2] [,3] [1,] -0.85074291 -0.2385149 0.4683451 [2,] 0.02907471 -0.9110909 -0.4111789 [3,] -0.52477726 0.3361905 -0.7820388 adeflate.C$W [,1] [,2] [,3] [1,] -0.001317682 -0.9904552102 -0.137828767 [2,] -0.006132130 0.1378342956 -0.990436316 [3,] 0.80330 -0.0004598964 -0.006255222 Can anyone throw light on this matter? On the other hand, using row.norm = F provides the following results: adeflate.R$W [,1] [,2] [,3] [1,] -0.86309623 -0.2103872 0.4591319 [2,] -0.01433631 -0.8985285 -0.4386811 [3,] -0.50483598 0.3852062 -0.7725003 which is not as much different (but still quite different) from adeflate.C$W [,1] [,2] [,3] [1,] -0.83111268 0.2247869 0.5086478 [2,] -0.01217191 0.9070906 -0.4207594 [3,] -0.55597085 -0.3558897 -0.7511584 What is the problem? Am I assuming something here that i should not in my inputs? Many thanks again for any help! Best wishes, Ranjan -- Important Notice: This mailbox is ignored: e-mails are set to be deleted on receipt. For those needing to send personal or professional e-mail, please use appropriate addresses. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FastICA
Maura E Monville maura.monville at gmail.com writes: Is the FastICA R implementation as good as the MatLab Implementation ? I would appreciate talking to someone who has used FastICA for R. The fastICA packages for Matlab and R (and there is even a version for Python) have a common origin at the Helsinki University of Technology. I regularly use Matlab and R, not seeing much of a difference in packages like these. // Hans Werner Borchers Thank you very much. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FastICA
On Tue, 12 Aug 2008, someone with no signature wrote: Maura E Monville maura.monville at gmail.com writes: Is the FastICA R implementation as good as the MatLab Implementation ? I would appreciate talking to someone who has used FastICA for R. The fastICA packages for Matlab and R (and there is even a version for Python) have a common origin at the Helsinki University of Technology. I regularly use Have you actually looked at the R one? The code has no connection with Helsinki University of Technology. 'Credit where credit is due' and all that. Matlab and R, not seeing much of a difference in packages like these. // Hans Werner Borchers Or quite possibly someone else using Mr Borchers name. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FastICA
Prof Brian Ripley ripley at stats.ox.ac.uk writes: On Tue, 12 Aug 2008, someone with no signature wrote: Maura E Monville maura.monville at gmail.com writes: Is the FastICA R implementation as good as the MatLab Implementation ? I would appreciate talking to someone who has used FastICA for R. The fastICA packages for Matlab and R (and there is even a version for Python) have a common origin at the Helsinki University of Technology. Have you actually looked at the R one? The code has no connection with Helsinki University of Technology. 'Credit where credit is due' and all that. Oh yes, you are right and I am sorry. I started working with fastICA for Matlab and referring to the page http://www.cis.hut.fi/projects/ica/fastica/ and its uncommented link to fastICA in R I always assumed it uses the same code base (never looking at 'credits'). Well, then you are the right person to answer this question. Matlab and R, not seeing much of a difference in packages like these. // Hans Werner Borchers Or quite possibly someone else using Mr Borchers name. Not really. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FastICA
I may not have been as wrong as Prof. Ripley suggested when I wrote The fastICA packages for Matlab and R (...) have a common origin at the Helsinki University of Technology. Please consider the following lines from the 'fastICA' help page (?fastICA): FastICA algorithm Description: This is an R and C code implementation of the FastICA algorithm of Aapo Hyvarinen et al. (URL: http://www.cis.hut.fi/aapo/) to perform Independent Component Analysis (ICA) and Projection Pursuit. So the C code base is not the same, I guess, but The code has no connection with Helsinki University of Technology does not seem to be totally correct. // Hans Werner Borchers Prof Brian Ripley wrote: On Tue, 12 Aug 2008, someone with no signature wrote: Maura E Monville maura.monville at gmail.com writes: Is the FastICA R implementation as good as the MatLab Implementation ? I would appreciate talking to someone who has used FastICA for R. The fastICA packages for Matlab and R (and there is even a version for Python) have a common origin at the Helsinki University of Technology. I regularly use Have you actually looked at the R one? The code has no connection with Helsinki University of Technology. 'Credit where credit is due' and all that. Matlab and R, not seeing much of a difference in packages like these. // Hans Werner Borchers Or quite possibly someone else using Mr Borchers name. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- View this message in context: http://www.nabble.com/FastICA-tp18928778p18940982.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FastICA
On Tue, 12 Aug 2008, someone with no credentials wrote: I may not have been as wrong as Prof. Ripley suggested when I wrote The fastICA packages for Matlab and R (...) have a common origin at the Helsinki University of Technology. Please consider the following lines from the 'fastICA' help page (?fastICA): FastICA algorithm Description: This is an R and C code implementation of the FastICA algorithm of Aapo Hyvarinen et al. (URL: http://www.cis.hut.fi/aapo/) to perform Independent Component Analysis (ICA) and Projection Pursuit. So the C code base is not the same, I guess, but The code has no connection with Helsinki University of Technology does not seem to be totally correct. It was 'totally correct'. Obviously fast ICA (the algorithm description) originated with someone at the Helsinki University of Technology, but the fastICA package for R has no other connection. This was like crediting R's and SAS's code for ANOVA to Rothamsted Research Station just because R. A. Fisher used to work there, and equally unhelpful. // Hans Werner Borchers Prof Brian Ripley wrote: On Tue, 12 Aug 2008, someone with no signature wrote: Maura E Monville maura.monville at gmail.com writes: Is the FastICA R implementation as good as the MatLab Implementation ? I would appreciate talking to someone who has used FastICA for R. The fastICA packages for Matlab and R (and there is even a version for Python) have a common origin at the Helsinki University of Technology. I regularly use Have you actually looked at the R one? The code has no connection with Helsinki University of Technology. 'Credit where credit is due' and all that. Matlab and R, not seeing much of a difference in packages like these. // Hans Werner Borchers Or quite possibly someone else using Mr Borchers name. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- View this message in context: http://www.nabble.com/FastICA-tp18928778p18940982.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fastICA
Hi everyone It looks like repeated runs of fastICA produce quite significantly different mixing matrices (not only in terms of sign and row order). I'm not a specialist, so would appreciate any advice on whether this should really be the case: res3 = fastICA(af[,2:20],4,alg.typ=parallel,fun=logcosh,alpha=1,method=C,row.norm=TRUE) colstandard res4 = fastICA(af[,2:20],4,alg.typ=parallel,fun=logcosh,alpha=1,method=C,row.norm=TRUE) colstandard res3$A [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9][,10] [,11] [,12] [1,] 0.3492656 0.47129703 0.11709867 -0.3866225 -0.3180731 -0.4991164 0.6215495 0.8923775 0.5595437 -0.074976310 -0.02226736 0.2540303 [2,] 0.3374660 0.39962068 0.24130395 -0.4555433 -0.2731303 -0.4717878 -0.1361462 -0.1812964 -0.4349231 0.001598010 0.05622615 0.3771093 [3,] 0.1577214 0.06431248 0.04530352 0.2426606 0.2546012 0.3607750 0.3066278 0.2459179 -0.1632415 0.079017073 -0.01756727 -0.6831387 [4,] 0.3024079 0.42547482 0.42272925 0.4219971 0.1849393 0.3102353 -0.2709699 -0.2480479 -0.2029552 0.186288059 -0.03772351 0.2284498 [,13] [,14] [,15] [,16][,17] [,18] [,19] [1,] -0.3560465 -0.8023760 -0.6901401 -0.09377930 0.039225519 0.01019511 -0.07118729 [2,] -0.1333961 0.3828090 0.4846588 -0.03412919 -0.009067316 -0.13459846 -0.01677050 [3,] -1.0164242 -0.2774528 0.2472543 0.05641915 0.112881877 -0.10800022 0.09233623 [4,] -0.1606417 -0.6265621 -0.6120113 -0.08991269 -0.052944720 -0.11545406 -0.06530203 res4$A [,1][,2][,3][,4][,5][,6] [,7][,8] [,9] [,10] [,11] [,12] [1,] 0.37425998 0.47693372 0.43825728 0.06634739 0.01113021 0.00141282 -0.4044253 -0.47496861 -0.5553201 0.14804389 0.01623842 0.3564346 [2,] -0.14173880 -0.04252148 -0.03162973 -0.24141814 -0.25736466 -0.36473238 -0.3000759 -0.23306483 0.1691999 -0.07594278 0.01626331 0.6948413 [3,] -0.05005946 -0.01742712 0.11216921 0.64260942 0.34415960 0.58450365 -0.1146743 -0.08045181 0.1442732 0.13216174 -0.06578838 -0.1372067 [4,] -0.43535000 -0.58086526 -0.21688752 0.34399283 0.29998124 0.47268328 -0.5527654 -0.81536674 -0.4607192 0.03768184 0.02307793 -0.3113437 [,13] [,14] [,15] [,16] [,17] [,18] [,19] [1,] -0.14663100 -0.01915221 0.04564954 -0.06653969 -0.04960206 -0.17660055 -0.04146818 [2,] 1.00383413 0.24516021 -0.27622870 -0.06074335 -0.11331305 0.10496803 -0.09549671 [3,] -0.01167087 -0.67320085 -0.73464239 -0.03193329 -0.03025987 0.01552101 -0.02808728 [4,] 0.41733259 0.86385119 0.72718191 0.10995336 -0.03082935 0.02770219 0.08069126 Many thanks Mikhail -- Mikhail Spivakov PhD Postdoctoral Fellow European Bioinformatics Institute European Molecular Biology Laboratory Hinxton Cambridgeshire CB10 1SD UK tel +44 1223 492 260 fax +44 1223 494 468 spivakov ebi ac uk -- View this message in context: http://www.nabble.com/fastICA-tp18506527p18506527.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.