eamid/trimap

initial coordinates are exported as `NaN` or throws an error

jlmelville opened this issue · 1 comments

First, thanks for your work on this package and technique and making it available for others to study and experiment with.

The following example (using return_seq=True) raises a ValueError for me:

import trimap
from sklearn.datasets import load_digits

digits = load_digits()

embedding = trimap.TRIMAP(return_seq=True).fit_transform(digits.data, init="pca")

Omitting the init argument and letting it be the default None, allows the computation to finish, but the initial coordinates are exported as nan:

embedding = trimap.TRIMAP(return_seq=True).fit_transform(digits.data)

embedding[:, :, 0]
array([[nan, nan],
       [nan, nan],
       [nan, nan],
       ...,
       [nan, nan],
       [nan, nan],
       [nan, nan]])

I think the following:

Y_all[:, :, 0] = Yinit

should be:

    Y_all[:, :, 0] = Y

as Y_init may hold a string like "random" (which causes the ValueError) or None (hence the nans).

Happy to provide a PR for this if needed.

eamid commented

Thank you for catching this! Happy to merge the fix if you could send a PR :)