{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6665","repository_url":"https://api.github.com/repos/scikit-learn/scikit-learn","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6665/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6665/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6665/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6665","id":148639142,"number":6665,"title":"t-SNE fails with array must not contain infs or NaNs (MKL specific and likely CPU specific)","user":{"login":"joelkuiper","id":971293,"avatar_url":"https://avatars.githubusercontent.com/u/971293?v=3","gravatar_id":"","url":"https://api.github.com/users/joelkuiper","html_url":"https://github.com/joelkuiper","followers_url":"https://api.github.com/users/joelkuiper/followers","following_url":"https://api.github.com/users/joelkuiper/following{/other_user}","gists_url":"https://api.github.com/users/joelkuiper/gists{/gist_id}","starred_url":"https://api.github.com/users/joelkuiper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelkuiper/subscriptions","organizations_url":"https://api.github.com/users/joelkuiper/orgs","repos_url":"https://api.github.com/users/joelkuiper/repos","events_url":"https://api.github.com/users/joelkuiper/events{/privacy}","received_events_url":"https://api.github.com/users/joelkuiper/received_events","type":"User","site_admin":false},"labels":[{"id":12995755,"url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels/Bug","name":"Bug","color":"e10c02","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21","html_url":"https://github.com/scikit-learn/scikit-learn/milestone/21","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones/21/labels","id":1970916,"number":21,"title":"0.19","description":"","creator":{"login":"amueller","id":449558,"avatar_url":"https://avatars.githubusercontent.com/u/449558?v=3","gravatar_id":"","url":"https://api.github.com/users/amueller","html_url":"https://github.com/amueller","followers_url":"https://api.github.com/users/amueller/followers","following_url":"https://api.github.com/users/amueller/following{/other_user}","gists_url":"https://api.github.com/users/amueller/gists{/gist_id}","starred_url":"https://api.github.com/users/amueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amueller/subscriptions","organizations_url":"https://api.github.com/users/amueller/orgs","repos_url":"https://api.github.com/users/amueller/repos","events_url":"https://api.github.com/users/amueller/events{/privacy}","received_events_url":"https://api.github.com/users/amueller/received_events","type":"User","site_admin":false},"open_issues":165,"closed_issues":66,"state":"open","created_at":"2016-08-29T22:34:33Z","updated_at":"2017-02-23T20:56:15Z","due_on":"2017-04-01T07:00:00Z","closed_at":null},"comments":89,"created_at":"2016-04-15T11:45:35Z","updated_at":"2017-02-24T01:35:41Z","closed_at":"2016-12-02T10:17:43Z","body":"```\nDarwin-15.0.0-x86_64-i386-64bit\n('Python', '2.7.11 |Anaconda custom (x86_64)| (default, Dec  6 2015, 18:57:58) \\n[GCC 4.2.1 (Apple Inc. build 5577)]')\n('NumPy', '1.11.0')\n('SciPy', '0.17.0')\n('Scikit-Learn', '0.17.1')\n```\n\nWhen trying to run a t-SNE \n\n```\nproj = TSNE().fit_transform(X)\nValueError: array must not contain infs or NaNs\n```\n\nHowever \n\n```\nnp.isfinite(X).all() # True \nnp.isnan(X).all() # False\nnp.isinf(X).all() # False\n```\n\nFull Stack Trace: \n\n```\n\nValueError                                Traceback (most recent call last)\n<ipython-input-16-c25f35fd042c> in <module>()\n----> 1 plot(X, y)\n\n<ipython-input-1-72bdb7124d13> in plot(X, y)\n     74 \n     75 def plot(X, y):\n---> 76     proj = TSNE().fit_transform(X)\n     77     scatter(proj, y)\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/sklearn/manifold/t_sne.pyc in fit_transform(self, X, y)\n    864             Embedding of the training data in low-dimensional space.\n    865         \"\"\"\n--> 866         embedding = self._fit(X)\n    867         self.embedding_ = embedding\n    868         return self.embedding_\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/sklearn/manifold/t_sne.pyc in _fit(self, X, skip_num_points)\n    775                           X_embedded=X_embedded,\n    776                           neighbors=neighbors_nn,\n--> 777                           skip_num_points=skip_num_points)\n    778 \n    779     def _tsne(self, P, degrees_of_freedom, n_samples, random_state,\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/sklearn/manifold/t_sne.pyc in _tsne(self, P, degrees_of_freedom, n_samples, random_state, X_embedded, neighbors, skip_num_points)\n    830         opt_args['momentum'] = 0.8\n    831         opt_args['it'] = it + 1\n--> 832         params, error, it = _gradient_descent(obj_func, params, **opt_args)\n    833         if self.verbose:\n    834             print(\"[t-SNE] Error after %d iterations with early \"\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/sklearn/manifold/t_sne.pyc in _gradient_descent(objective, p0, it, n_iter, objective_error, n_iter_check, n_iter_without_progress, momentum, learning_rate, min_gain, min_grad_norm, min_error_diff, verbose, args, kwargs)\n    385     for i in range(it, n_iter):\n    386         new_error, grad = objective(p, *args, **kwargs)\n--> 387         grad_norm = linalg.norm(grad)\n    388 \n    389         inc = update * grad >= 0.0\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/scipy/linalg/misc.pyc in norm(a, ord, axis, keepdims)\n    127     \"\"\"\n    128     # Differs from numpy only in non-finite handling and the use of blas.\n--> 129     a = np.asarray_chkfinite(a)\n    130 \n    131     # Only use optimized norms if axis and keepdims are not specified.\n\n/Users/joelkuiper/anaconda/lib/python2.7/site-packages/numpy/lib/function_base.pyc in asarray_chkfinite(a, dtype, order)\n   1020     if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():\n   1021         raise ValueError(\n-> 1022             \"array must not contain infs or NaNs\")\n   1023     return a\n   1024 \n\nValueError: array must not contain infs or NaNs\n```\n"},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/282177650","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6665#issuecomment-282177650","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6665","id":282177650,"user":{"login":"BerenLuthien","id":20260688,"avatar_url":"https://avatars.githubusercontent.com/u/20260688?v=3","gravatar_id":"","url":"https://api.github.com/users/BerenLuthien","html_url":"https://github.com/BerenLuthien","followers_url":"https://api.github.com/users/BerenLuthien/followers","following_url":"https://api.github.com/users/BerenLuthien/following{/other_user}","gists_url":"https://api.github.com/users/BerenLuthien/gists{/gist_id}","starred_url":"https://api.github.com/users/BerenLuthien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BerenLuthien/subscriptions","organizations_url":"https://api.github.com/users/BerenLuthien/orgs","repos_url":"https://api.github.com/users/BerenLuthien/repos","events_url":"https://api.github.com/users/BerenLuthien/events{/privacy}","received_events_url":"https://api.github.com/users/BerenLuthien/received_events","type":"User","site_admin":false},"created_at":"2017-02-24T01:35:41Z","updated_at":"2017-02-24T01:35:41Z","body":"Hi \r\nI tried two setups, where\r\n\r\n- TSNE works well with one setup (where Tensorflow is de-activated, Python-3.x), however,\r\n\r\n- TSNE does not work with the other setup (where Tensorflow is activated, Python 2.x).\r\n\r\n\r\n**The set up where TSNE works well:**\r\n\r\nTerminal:\r\n```\r\nMacbook:~ BG$ which jupyter\r\n/Users/BG/anaconda/bin/jupyter\r\n\r\n```\r\nJupyer notebook:\r\n```\r\nimport sys\r\nprint (sys.version)\r\n```\r\n>>\r\n```\r\n3.5.2 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:52:12) \r\n[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]\r\n```\r\nNote: I tried\r\n```\r\nconda remove numpy --force -y\r\npip uninstall numpy -y\r\nconda install numpy\r\n```\r\nto make TSNE work well with Tensorflow deactivated.\r\nHowever, with the new setup below (where I have to use Tensorflow), this does not work any more.\r\n——-———-———-———-———-———-———-———-\r\n\r\n**The set up where TSNE does not work:**\r\n\r\n**Terminal:**\r\n```\r\nMacbook:~$ source activate tensorflow\r\n(tensorflow) Macbook:~$ which jupyter\r\n/Users//anaconda/envs/tensorflow/bin/jupyter\r\n(tensorflow) Macbook:~$ \r\n```\r\n\r\n**Jupyer notebook:**\r\n```\r\nimport sys\r\nprint (sys.version)\r\n```\r\n>>\r\n\r\n```\r\n2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08) \r\n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]\r\nError: ValueError: array must not contain infs or NaNs\r\n```\r\n\r\n\r\nAny suggestions ? Thanks a lot"}}
{"actor":{"display_login":"BerenLuthien"}}