uwot
uwot copied to clipboard
retrieve umap parameters
How do you retrieve the min_dist and n.neighbors input parameter values from a umap object?
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.
On the master
branch, min_dist
and spread
are now exported as part of the model when ret_model = TRUE
.