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

Bugs of core/tsne_torch_loss.py #2

Open
amylmy opened this issue Jun 9, 2022 · 2 comments
Open

Bugs of core/tsne_torch_loss.py #2

amylmy opened this issue Jun 9, 2022 · 2 comments

Comments

@amylmy
Copy link

amylmy commented Jun 9, 2022

Thanks for your excellent work. However, there are problems when I test with your code.
In line 6

from sklearn.manifold.t_sne import _joint_probabilities, _joint_probabilities_nn

Should it be from sklearn.manifold._t_sne ?

This was successfully imported after changing t_sne to _t_sne. However, the _joint_probabilities_nn reported only taking 3 positional arguments, but 4 were given. And After I fixed this, another error occurred...
Could you tell me how to solve this?
Thanks.

@amylmy amylmy changed the title Bugs of core\tsne_torch_loss.py Bugs of core/tsne_torch_loss.py Jun 9, 2022
@choltz95
Copy link

Have you figured this out? Was hoping to run this on colab, but downgrading sklearn takes a really long time.

@J1anShen
Copy link

In the tsne_torch_loss.py file, you can modify the code for the error section as follows:

# compute the joint probability distribution for the input space
row_index = [i for i in range(distances_nn.shape[0]) for j in range(distances_nn.shape[1])]
col_index = [i for i in neighbors_nn.reshape(-1)]
distances_nn_ = sp.csr_matrix((distances_nn.reshape(-1), (row_index, col_index)),
                                  shape=(distances_nn.shape[0], distances_nn.shape[0]))
P = _joint_probabilities_nn(distances_nn_, perplexity, verbose)

To verify the correctness of this modification, you can run the test_tsne_torch_loss.py file located in the tests directory.

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