3

As you see, error raised:

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/sklearn/decomposition/pca.py", line 86, in _assess_dimension_ (1. / spectrum_[j] - 1. / spectrum_[i])) + log(n_samples)

ValueError: math domain error

I already know that math domain error is caused when we take logarithm of a negative number, but I don't understand how can there be a negative number inside the logarithm? Can someone tell me what exactly the problem is?

Here is the origin code:

    pca = PCA(n_components='mle')
    pca.fit(data)
    joblib.dump(pca, "../../conf/pca.cf")
    data = pca.transform(data)

The elements in Matrix are all greater than or equal to 0.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
C. Xi
  • 31
  • 2
  • Just had the same issue. Checkout: https://stackoverflow.com/questions/36921068/math-domain-error-while-using-pca – Jojo Oct 26 '17 at 14:06

0 Answers0