Skip to content
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

retrieve umap parameters #95

Closed
kjiang18 opened this issue Jul 13, 2022 · 2 comments
Closed

retrieve umap parameters #95

kjiang18 opened this issue Jul 13, 2022 · 2 comments

Comments

@kjiang18
Copy link

How do you retrieve the min_dist and n.neighbors input parameter values from a umap object?

@jlmelville
Copy link
Owner

If you have a model generated by e.g.:

iris_umap <- umap(iris, ret_model = TRUE)

then you can find the number of neighbors via iris_umap$n_neighbors. Unfortunately, neither min_dist nor spread are saved in the model. The related a and b parameters are available via iris_umap$a and iris_umap$b. If the actual value of min_dist isn't that important then you could roughly back-convert it by converting a look up table like:

 sapply(c(0.1, 0.001, 0.0001), uwot:::find_ab_params, spread = 1)

which will give you the a, b parameters for min_dist = 0.1, 0.001, 0.0001 in this example (use whatever range of min_dist will give you the required accuracy). I am assuming that spread is left at its default value of spread = 1.

I could add min_dist and spread to the return value of umap for a future release if that would be helpful.

@jlmelville
Copy link
Owner

On the master branch, min_dist and spread are now exported as part of the model when ret_model = TRUE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants