kernelPCA centering #337

rcurtin opened this Issue Dec 29, 2014 · 1 comment


None yet

1 participant

rcurtin commented Dec 29, 2014

Reported by Niteloser on 18 Dec 44486392 02:19 UTC
I have had a look at the kernelPCA source code. When you centre a kernel matrix, should

arma::sum(kernelMatrix, 1) / kernelMatrix.n_cols;

not be computed before you subtract the means from the rows in the previous line?
I seem to be getting inconsistent results when using it, with the first PC disagreeing
with alternative implementations, but then agreeing from the second PC onwards. This seems like a tell-tale sign of centring going wrong.

@rcurtin rcurtin self-assigned this Dec 29, 2014
@rcurtin rcurtin added this to the mlpack 1.0.9 milestone Dec 29, 2014
@rcurtin rcurtin closed this Dec 29, 2014
rcurtin commented Dec 30, 2014

Commented by rcurtin on 15 Nov 44487334 06:03 UTC
Nice catch, thank you! I've committed a fix in r16722. Can you test the current svn trunk with alternative implementations again, and if they still disagree, can you reopen this ticket? You can get the svn trunk from the subversion repository at Then, if there is still a problem, we can look into it further.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment