David Brough
2016-03-30 17:15:44 UTC
Hello all,
I have a complex valued array that I would like to do PCA on, but I am
running into an issue where
sklearn is casting the complex128 array as a float64.
X = np.random.random((30, 50)) + 1j * np.random.random((30, 50))
pca = RandomizedPCA()
pca.fit(X)
ComplexWarning: Casting complex values to real discards the imaginary
part
It looks like it is coming form the following lines of code.
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/decomposition/pca.py#L639
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/validation.py#L101
Is there a way to do PCA on complex valued array with sklearn?
Thanks,
David
I have a complex valued array that I would like to do PCA on, but I am
running into an issue where
sklearn is casting the complex128 array as a float64.
X = np.random.random((30, 50)) + 1j * np.random.random((30, 50))
pca = RandomizedPCA()
pca.fit(X)
ComplexWarning: Casting complex values to real discards the imaginary
part
It looks like it is coming form the following lines of code.
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/decomposition/pca.py#L639
https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/validation.py#L101
Is there a way to do PCA on complex valued array with sklearn?
Thanks,
David