-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
sklearn.manifold.TSNE, ValueError: Buffer dtype mismatch, expected 'float_t' but got 'float' #4124
Copy link
Copy link
Closed
Description
Thank you so much for adding sklearn.manifold.TSNE, I'm very excited that it's now part of sklearn! However, when I try using it, I get the following error message (both with 0.15.2 and 0.16):
Traceback (most recent call last):
File "main.py", line 104, in <module>
vectors_tsne = do_tsne_on_vectors( vectors_in_file )
File "main.py", line 56, in do_tsne_on_vectors
return tsne.fit_transform( vectors )
File "(...)/sklearn/manifold/t_sne.py", line 519, in fit_transform
self._fit(X)
File "(...)/sklearn/manifold/t_sne.py", line 444, in _fit
P = _joint_probabilities(distances, self.perplexity, self.verbose)
File "(...)/sklearn/manifold/t_sne.py", line 51, in _joint_probabilities
distances, desired_perplexity, verbose)
File "_utils.pyx", line 14, in sklearn.manifold._utils._binary_search_perplexity (sklearn/manifold/_utils.c:2023)
ValueError: Buffer dtype mismatch, expected 'float_t' but got 'float'To fix this, I did:
vectors = np.asfarray( vectors, dtype='float' )
which seems to work for me.
My input is a list of vectors I get from gensim.models.word2vec.
Kind regards and thanks for the great library!
Hendrik
Reactions are currently unavailable