Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[MRG+2] Incorrect implementation of explained_variance_ in PCA #9105
What does this implement/fix? Explain your changes.
The result of explained_variance_ is wrong.
Reason for the incorrect implementation.
(1)In the code,
Any other comments?
I provide two ways for the new test, one based on current version, another based on the definition.
changed the title from
[MRG] Incorrect implementation of explained_variance_ in PCA
[MRG+1] Incorrect implementation of explained_variance_ in PCA
Jun 12, 2017
@qinhanmin2014 I think when looking at #7699 I checked the definition of PCA, and I don't think any of the books I looked at mentioned the bessel correction. In particular Elements of Statistical Learning, which is my standard reference. Can you provide a reference with your definition, other than prcomp?
(1)I think the problem is not whether to use bessel correction. The main point is that the variance is supposed to be equal to the eigenvalue of the covariance matrix. I propose an additional test to prove my implementation.
What's more, from my perspective, even if we dont't find any strong evidence, it may be better to ensure that sklearn behave the same as others.