rasbt/mlxtend

Use SciPy SVD instead of NumPy SVD.

rasbt opened this issue · 1 comments

As noted here NumPy's SVD can occasionally be incorrect, and it is better to use scipy.linalg.svd(cov, lapack_driver='gesvd') instead.

SVD is used in the PCA class here: https://github.com/rasbt/mlxtend/blob/master/mlxtend/feature_extraction/principal_component_analysis.py

There are potential performance benefits as well. From scipy's documentation:

... advantage of using scipy.linalg over numpy.linalg is that it is always compiled with BLAS/LAPACK support, while for
NumPy this is optional. Therefore, the SciPy version might be faster depending on how NumPy was installed.

So the class could also benefit from using the scipy's eigendecomposition.