-
Notifications
You must be signed in to change notification settings - Fork 31
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
Metric = "precomputed" is not implimented #22
Comments
It may be the case that uwot can already do what you want. If you have created a full distance matrix yourself, then if you convert it to a iris_dist <- dist(iris[, -5])
iris_umap <- umap(iris_dist) I do see that Thank you for the suggestion about other metrics and the vote for Pearson. I would also like to see more, but uwot relies on the metrics that Annoy supports. It's possible that I will get more of the neighbor search part of PyNNDescent implemented in R and then more metrics will be available. |
Thank you for the suggestions. I have successfully run uwot::umap() with Pearson correlation via nn_method = list(idx = index_matrix, dist = dist_matrix) and via uwot::umap(dist(dist_matrix), metric = "precomputed"). My dist_matrix and index_matrix were created with Pearson correlation. Unfortunately, I wanted to do metric learning which isn't possible through this implementation. |
Although I suspect that this is way too late for @rach226a purposes, I am temporarily re-opening to note that:
But it would be better for |
I have a distance matrix calculated with a non-supported metric (earth mover distance). How can I get it into the required format? |
To carry out UMAP successfully your NN data should be be in the form of a list consisting of two If you have full dense iris10 <- as.matrix(iris[1:10, -5])
iris10_dm <- as.matrix(dist(iris10))
# get 4 nearest neighbors
iris10_nn <- uwot:::dist_nn(iris10_dm, k = 4) |
Thanks!
*David Katz*, TIBCO Data Science
|
Using precomputed nearest neighbors is covered at https://jlmelville.github.io/uwot/articles/hnsw-umap.html and https://jlmelville.github.io/uwot/articles/rnndescent-umap.html. Pearson correlation is now supported with |
Metric = "precomputed" is not implemented
I would like to run uwot::umap() with metric = 'pearson'. However, 'pearson' is not an option with within this package and I got the following error:
Error in match.arg(metric, c("euclidean", "cosine", "manhattan", "hamming", : 'arg' should be one of “euclidean”, “cosine”, “manhattan”, “hamming”, “precomputed”
This error suggests that I can use a "precomputed" distance matrix. So I tried to run uwot::umap() with metric = 'precomputed' and got the following error:
Error in create_ann(metric, nc) : BUG: unknown Annoy metric 'precomputed'
This error suggests precomputed is not implemented within this package.
PS. The original umap package allows for metrix = 'pearson.' It would be nice to see this added to this package!
The text was updated successfully, but these errors were encountered: