Skip to content
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

TSNE示例代码有问题,报错 #435

Open
WithChameleon opened this issue Oct 10, 2021 · 2 comments
Open

TSNE示例代码有问题,报错 #435

WithChameleon opened this issue Oct 10, 2021 · 2 comments

Comments

@WithChameleon
Copy link

import numpy as np
from sklearn.manifold import TSNE
X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
X_embedded = TSNE(n_components=2, learning_rate='auto', init='random').fit_transform(X)

error:TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')

@WithChameleon
Copy link
Author

error: numpy.core._exceptions._UFuncNoLoopError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')

@iTzAlver
Copy link

iTzAlver commented May 3, 2023

import numpy as np
from sklearn.manifold import TSNE
X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])
X_embedded = TSNE(n_components=2, perplexity=1, learning_rate='auto', init='random').fit_transform(X)

It is working for numpy 1.23.5 and scikit-learn 1.2.2.
You must provide a perplexity lower than n_components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants