leowyy / GraphTSNE

PyTorch Implementation of GraphTSNE, ICLR’19
MIT License
134 stars 23 forks source link

Bugs of core/tsne_torch_loss.py #2

Open amylmy opened 2 years ago

amylmy commented 2 years ago

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.

choltz95 commented 1 year ago

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

J1anShen commented 1 year ago

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.