-
Notifications
You must be signed in to change notification settings - Fork 915
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
possible problem using umap_transform with nearest neighbor distance #4972
Comments
Hi, James seurat/R/dimensional_reduction.R Lines 1389 to 1397 in 13b615c
The model is a UMAP model from the reference data.The object here is a list which contains the knn neighbors index and distance. The names of these two elements are idx and dist . For example,
They fit the input format of Technically, we calculated seurat/R/dimensional_reduction.R Lines 366 to 377 in 13b615c
Also, thanks for pointing out correlation metric in |
Thanks for looking at this @yuhanH.
No there will just be a documentation change.
Ok that’s good to know. That is the correct data format, no changes need to be made in Seurat, and existing workflows are also giving the correct results. The concern I raised in this issue is not actually a problem. |
Sounds great! Thanks. |
Uwot correlation metric is added in the develop branch version 4.0.4.9002 |
This may be related to #4647: I recently discovered a documentation issue with
umap_transform
. This might affectRunUMAP.default
, where it callsumap_transform
withX = NULL
andnn_method = object
:seurat/R/dimensional_reduction.R
Lines 1362 to 1370 in af2925c
I am not sure what
object
is. But the documentation forumap_transform
was misleading. To be clear, the pre-computed nearest neighbor data that can be passed to thenn_method
parameter should consist of:umap
function and is part of themodel
data), not the new data to be transformed.For example, if the first row of
object$idx
looks like:that means the 4 nearest neighbors to the first item you want to add to the existing embedding can be found in rows 1, 5, 8 and 10 of the matrix/data-frame passed to the
umap
function'sX
parameter, not the data you want to transform.Another way to put this is if you want to use the
nn_method
parameter this way, you must:umap
).umap_transform
).Hopefully I am not belaboring the point, but it's tricky to describe the difference and the documentation was misleading. I am now fixing the documentation and adding more validation to
umap_transform
. I also don't actually know if there is any problem to solve here: maybe theobject
is correctly constructed. If not, then please be aware that:seurat/R/dimensional_reduction.R
Line 1372 in af2925c
umap_transform
a new release ofuwot
to CRAN may cause test errors and existing workflows which used to do the wrong thing silently will start (correctly) failing. I am unlikely to even start the reverse dependency checking as part of the CRAN release workflow for a few weeks, however.If this turns out to be a real problem, my apologies to you and your users for this error.
Finally, a small FYI about:
seurat/R/dimensional_reduction.R
Lines 1285 to 1292 in af2925c
uwot
has supported the (Pearson) correlation metric since 0.1.9 (released on CRAN in November 2020).The text was updated successfully, but these errors were encountered: