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
t-SNE fails with array must not contain infs or NaNs (OSX specific) #6665
Comments
Same with ('Scikit-Learn', '0.18.dev0') |
Do you mind sharing your data X with me? |
Sure, where and in what format would you like it?
|
My email is 370846270@qq.com |
I test your data in ubuntu 14.04 LTS with from sklearn.manifold import TSNE Then i upgrade numpy, scipy to 1.11.0, 0.17.0 and test with the same code and it also doesn't raise any error. |
Reproduced for 3.5 with anaconda under OS X El Capitan.
Example run: import random
from sklearn.manifold import TSNE
random.seed(1)
a = np.random.uniform(size=(100,20))
TSNE(n_components=2).fit_transform(a) |
Thanks @ivan-krukov, but I'm failing to replicate in Python 3.3. Will try 3.5 |
This does not apply to |
I'm on El-Capitan, but I'm failing to get a Python 3.5 installation up and running. |
Is there any update on this? I have the issue on a dataset of mine, on Anaconda, Py 3.5, sklearn 0.17.1, OSX El Capitan. |
Same issue. Python 2.7.6 on OS X El Capitan on 0.17. Tried the same code on Linux using Python 2.7.6 and 0.17, and it works. |
Same issue. |
I have the same problem and would really appreciate a fix (or workaround?) I can also reproduce the bug with the code sample from ivan-krukov |
Same issue on OS X EI Capitan using Python 3.5 |
System Version: OS X 10.11.5 Same problem. Though I have noticed that it only occurs for a subset of my dataset and not with the whole thing. That is, if I do TSNE on the whole data set it works, if I do it on a reduced set it does not. |
O_o;; This just in, if I repeat the same 'broken' subset that doesn't work(by means of list*10) then it works. Multiplying each individual vector by 10 doesn't work, but duplicating the date does. just doubling the length of the list is insufficient. Maybe this is some kind of degrees of freedom check run amok? |
@ivan-krukov I bit the bullet today and installed an El Capitan VM. Unfortunately I can not reproduce your problem. @Concomitant can you reproduce the error on the stand-alone example given in #6665 (comment)? |
@jnothman it doesn't seem to be happening only on Python 3.5 so if you could try to reproduce with Python 2.7 (snippet: #6665 (comment)) that would be great. |
@lesteve I can reproduce the issue.
Following the same code, however:
Bizarre. |
I cannot reproduce either with python 3.5.1, numpy 1.11.1, scipy 0.17.1 and scikit-learn 0.17.1 from miniconda (with MKL) on a virtualbox with OSX El Capitan. I will try on a real mac hardware later. |
Also @joelkuiper and @Concomitant can you please check that you can reproduce the problem on the current state of the scikit-learn master branch? |
@lesteve and others I cannot reproduce the error with the snippet posted earlier on the latest master with python 2.7. System info:
|
I tried again on a real mac running OSX El Capitan 10.11.3 (with anaconda's latest numpy scipy and scikit-learn, same setting as reported by @Concomitant in #6665 (comment)) but could not reproduce the problem either (tried running the snippet several times). What is weird though it that the despite the |
Actually I read @Concomitant's code snippet too quickly: instead of |
Also I now realized that I read the whole discussion too quickly and that the bug only happens with python 2.7. Will try again. |
I cannot reproduce either with python 2.7.12 from conda on OSX 10.11.3 either. Actually @Ekliptor can reproduce the issue with python 3.5.1 from conda so it's probably not related to the version of Python either. Maybe it depends on the minor version of OSX. Will upgrade and retry. |
I cannot replicate either with OSX 10.11.5. I tried both with Python 2.7.12 and 3.5.2 installed with conda along with numpy 1.11.1, scipy 0.17.1 and scikit-learn 0.17.1. I don't know what to do. If one of you can reproduce the problem, please try to find a numpy random seed that trigger the issue (using |
I can confirm the issue is fixed with the latest version. I can not reproduce it anymore as before. To all people working with Tensorflow I can add: |
For anyone affected by this, this should fix it: conda remove numpy --force -y
pip uninstall numpy -y
conda install numpy Let me know if that doesn't work for you. |
Thanks for the deep dive (again!) @lesteve |
I thought we would never get to the bottom of this one to be honest :) ! OK it's not quite the bottom but it's low enough as far as I am concerned. I have to admit I would still like to understand what's happening within the numpy installed with both pip and conda ... |
Hi
The set up where TSNE works well: Terminal:
Jupyer notebook:
Note: I tried
to make TSNE work well with Tensorflow deactivated. The set up where TSNE does not work: Terminal:
Jupyer notebook:
Error: Any suggestions ? Thanks a lot |
Interesting. I think it has nothing to do with tensorflow; my guess is that [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] vs [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] is the culprit!? |
Thanks for response :) Any suggested solutions/to_do_list ? Need use both BTW: just tried "from future import division" in Python 2.x and did not solve the problem. |
Hm, not sure if that helps -- personally, I am not getting this mysterious issue anymore with
I am on Tf (now 1.0) as well, and I don't have this
which previously didn't work. Maybe try to create a new python 3.5 env and try the above-mentioned snippet to see if it works without error:
|
Hi rasbt, Thanks for your help. |
Do you have an old(er) Miniconda/Anaconda 2.7 distro installed? In this case, maybe consider installing one of the more recent ones, or update your conda root or default python and give it another try (or create a new py 27 env by substituting the 3.5 by 2.7 in |
Update: TSNE(perplexity=30, n_components=2, init='pca', n_iter=1000, method='exact') make it worked ... |
Also been having this problem. Using method='exact' seems to works for me, but it is so painfully slow. Is there really no other solution that people have found? |
Have you read #6665 (comment) and #6665 (comment) ? The only way I managed to reproduce this problem was to install numpy with both pip and conda in the same conda environment. If you create a conda environment from scratch you should not have this problem. In case your problem do not seem to match this description, please post the exact commands you ran to create your conda environment, so we can try to reproduce. |
Hi,
And the output of
is
Again, changing the method to exact ( More generally, I have noticed wildly different results when using sklearn's TSNE (with identitical perplexity and other parameters) from the bh implementation published by Laurens van der Maaten and the MATLAB version. I wonder if there may be a connection? |
Did you refer to #6665 (comment) |
That fixed it. My apologies - I had separately uninstalled an reinstalled numpy, scikit learn and scipy, but not like in 6665. |
I had the same problem as reported here, and I do not use conda. My Python version is installed via brew on macOS Sierra 10.12.4
Adding |
@lesteve: i had this error using the setup you describe (two versions of numpy installed). simply updating the conda install of numpy to the same version as the pip install (1.12.1) did the trick for me. i did remove the pip numpy install, though, as i didn't intend to have two versions :) |
@lesteve: Thank you for the solution! I happened to have this error and then I found this discussion. Fix it right away after remove the duplicated version of numpy. |
Replicated I have removed pip installs of numpy and updated conda. Darwin-16.7.0-x86_64-i386-64bit It seems fine on my linux machine Linux: |
@wolfiex so you did
Somewhat related I recommend you update to scikit-learn 0.19 which has some fixes in t-SNE |
getting the same error now |
Hi @rahulsnair , do you mind opening a new issue, with reproducible code, your traceback and the versions you are using? This issue is pretty old and the code has changed a lot. Thanks! |
When trying to run a t-SNE
However
Full Stack Trace:
The text was updated successfully, but these errors were encountered: