在PyCharm和Terminal('$ python word2vec_basic.py')的mac上运行word2vec_basic.py时出错。
我的mac版本如下: *平台:Darwin-15.6.0-x86_64-i386-64bit * python:3.6.0 * numpy:1.12.1 * scipy:0.19.0 * sklearn:0.18.1
错误如下:
Traceback (most recent call last):
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-35-c6c4cd8ccf88>", line 8, in <module>
low_dim_embs = tsne.fit_transform(final_embeddings[:plot_only, :])
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/sklearn/manifold/t_sne.py", line 884, in fit_transform
embedding = self._fit(X)
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/sklearn/manifold/t_sne.py", line 789, in _fit
skip_num_points=skip_num_points)
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/sklearn/manifold/t_sne.py", line 847, in _tsne
**opt_args)
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/sklearn/manifold/t_sne.py", line 388, in _gradient_descent
grad_norm = linalg.norm(grad)
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/scipy/linalg/misc.py", line 129, in norm
a = np.asarray_chkfinite(a)
File "/Users/HYJ/anaconda3/lib/python3.6/site-packages/numpy/lib/function_base.py", line 1215, in asarray_chkfinite
"array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs