[mlpack] PCA has to negate every element

Ryan Curtin ryan at ratml.org
Thu Mar 3 12:26:09 EST 2016


On Thu, Mar 03, 2016 at 04:30:21PM +0800, Shaoxiang Chen wrote:
> Because the matrices in mlpack are column-major, the results of pca is the
> negative of correct results according to this line
> <https://github.com/mlpack/mlpack/blob/21b198b20beae6e567dc8c1e47293ddde562bef2/src/mlpack/tests/pca_test.cpp#L76>
> of code.
> Isn't it more reasonable to negate inside Apply()?

Hi Shaoxiang,

Not in this case: the PCA results are correct whether or not the
eigenvectors are negated.  Negating the results inside Apply() would not
only make Apply() take longer, but also has the problem that it's
unclear which eigenvectors should even be negated.

The purpose of the negation here is only to make sure that the results
are comparable to the reference results.

Thanks,

Ryan

-- 
Ryan Curtin    | "I'm going to be on television!"
ryan at ratml.org |   - Sara Goldfarb



More information about the mlpack mailing list