-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
pca.fit_transform returns error: array must not contain infs or NaNs #18138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
sklearn.show_versions() System: Python dependencies: Built with OpenMP: True |
Line 134 - 135: |
Verified no NaN and inf in the input: np.any(np.isnan(normalised_tfidf)) np.any(np.isinf(normalised_tfidf)) |
Working fine on: Python dependencies: |
worked in this env: System: Python dependencies: Built with OpenMP: True |
May you provide the dataset that caused the issue so that we can reproduce it? |
Issue resolved. Can not reproduce anymore |
Hello, can you share the solution, pls? As from sklearn > 0.22.1 I have the same issue with many random datasets which never produced such errors before. Oddly enough, if I add a simple loop e.g.: then with the second run it ALWAYS passes without error... As I saw people discussing this issue on forums, I believe it is worthy to solve it in a general way. |
can someone share the solution please ?????? |
@RamziRahli, check #19285 |
@MichalRIcar I just did and it still doesn't work :/ |
@MichalRIcar @RamziRahli May you provide the dataset that causes the error for you? This will help us debug this issue. |
@lukemao Hi! Mr. lukemao, I got a same question while processing a huge data. May I ask you how you solved your problem? I have tried all debugging methods of this issue, but they didn't work. Thank you! |
How did you solve it· |
The unexplained bugs. The same python, numpy and sklearn version on Windows and Wsl2 (Ubuntu). Windows works well but Wsl2 has this issue. |
bro , you got the solution ? |
When I call PCA's fit_transform method I am getting error array must not contain infs or NaNs
Actual code:
sklearn_pca = PCA(n_components = 3) input_vec = sklearn_pca.fit_transform(normalised_tfidf)
Checked if there are infs and NaNs in the input array:
np.any(np.isnan(normalised_tfidf))
Out[2]: False
np.any(np.isinf(normalised_tfidf))
Out[3]: False
Versions:
Python: 3.8
Anaconda: 1.9.12
Sklearn: 0.23.1
The text was updated successfully, but these errors were encountered: