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

Visualizing_embeddings_in_2D - AttributeError: 'list' object has no attribute 'shape' #37

Closed
drnic opened this issue Nov 25, 2022 · 3 comments

Comments

@drnic
Copy link

drnic commented Nov 25, 2022

When I run the examples/Visualizing_embeddings_in_2D.ipynb notebook, I get an error during tsne.fit_transform(matrix):

    791 def _check_params_vs_input(self, X):
--> 792     if self.perplexity >= X.shape[0]:
    793         raise ValueError("perplexity must be less than n_samples")

AttributeError: 'list' object has no attribute 'shape'

Is this a problem with library versions I have installed? A regression from newer versions?

image

image

Sorry if this is a noob python/pandas library mismatch question.

@ted-at-openai
Copy link
Collaborator

I tried to reproduce but it works fine for me. I see that your sklearn package says that it's deprecated and to use scikit-learn instead. Suspect that might be your problem.

@ted-at-openai
Copy link
Collaborator

Try installing scikit-learn and see if that fixes things for you. Thanks for including the helpful screenshots!

@rastan77
Copy link

rastan77 commented Oct 16, 2023

I have scikit-learn and it is showing me the same AttributeError.
I imported numpy as np and wrote this line of code: matrix = np.array(matrix)
I wrote the code before I passed the variable to fit_transform() like this:
import numpy as np
...
matrix = np.array(matrix)
vis_dims = tsne.fit_transform(matrix)
...
This worked for me.

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

3 participants