Distance matrix as input
Vykintasj opened this issue · 3 comments
Hi,
is it possible to use a precomputed distance matrix as input? / will it be added in the future?
Thank you for the reply.
Best regards,
Vykintas
Hi Vykintas,
Excellent idea! I will add this feature soon :)
Thank you,
Ehsan
Hi Vykintas,
You can now use a precomputed distance matrix as input. To find the embedding using the pairwise distance matrix D, pass D as input and set use_dist_matrix to True:
embedding = trimap.TRIMAP(use_dist_matrix=True).fit_transform(D)
You can also pass the precomputed k-nearest neighbors and their corresponding distances as a tuple (knn_nbrs, knn_distances). Note that in this case, the rows must be in order, starting from point 0 to n-1. This feature also requires X to compute the embedding
embedding = trimap.TRIMAP(knn_tuple=(knn_nbrs, knn_distances)).fit_transform(X)
Please let me know if you find any bugs / errors. Also let me know if you have any comments. Your feedback is highly appreciated.
Ehsan
Hi Ehsan,
I tried only the distance matrix - it works just as intended. Thank you for the implementation!
Vykintas