2
$\begingroup$

There are two packages in R that implement the UMAP algorithm for low-dimensional embedding ('uwot' and 'umap'). I've found they can give vastly different results for some datasets. For example, the embeddings below are of the same $4001$ equidistant points in $R^{4000}$.

enter image description here

In this case the 'umap' package seems to give a better gestalt of a set of equidistant points. On the other hand, in other cases such as the UMAP on Cartesian coordinates of 41K cities below, 'uwot' seems much better.

enter image description here

I was hoping someone could explain the main differences between these two implementations and give some general advice as to when to use which package.

$\endgroup$
0
$\begingroup$

I maintain the uwot package. It's an independent implementation of UMAP (although it relied strongly on me looking at the code of the "real" Python UMAP package during its development).

The umap R package also has its own independent implementation of UMAP (the default) or can use the Python UMAP if it's available to your R environment. I am not sure which approach produced the results above, though.

The first result from uwot certainly looks odd. My strong suspicion would be that the nearest neighbor routine used by uwot (Annoy via the RcppAnnoy package) is failing due to the rather high dimensionality of the input data. I am not sure how the umap R package calculates the nearest neighbors but I don't think it uses Annoy, so that might explain the difference.

The difference in the second result might be due to differences in initialization. Very hard to say though.

Although I am unable to answer your question here, if you are willing to open an issue at the uwot issue tracker with details of how the input data was generated and how uwot was run I can investigate the problem with the first result.

New contributor
James Melville is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.