r UMAP
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r UMAP相关的知识,希望对你有一定的参考价值。
#install UMAP from https://github.com/lmcinnes/umap
#install.packages("rPython")
umap <- function(x,n_neighbors=10,n_components=2,min_dist=0.1,metric="euclidean"){
x <- as.matrix(x)
colnames(x) <- NULL
rPython::python.exec( c( "def umap(data,n,d,mdist,metric):",
"\timport umap" ,
"\timport numpy",
"\tembedding = umap.UMAP(n_neighbors=n,n_components=d,min_dist=mdist,metric=metric).fit_transform(data)",
"\tres = embedding.tolist()",
"\treturn res"))
res <- rPython::python.call( "umap", x,n_neighbors,n_components,min_dist,metric)
do.call("rbind",res)
}
data(iris)
res <- umap(iris[,1:4])
以上是关于r UMAP的主要内容,如果未能解决你的问题,请参考以下文章
R语言plotly可视化:使用UMAP算法将数据降维到二维并使用plotly可视化降维后的数据(project data into 2D with umap and px.scatter)
R语言plotly可视化:使用UMAP算法将数据降维到三维并使用plotly可视化降维后的数据(project data into 3D with UMAP and px.scatter_3d)
python umap可视化学习
std::multimap 按照key遍历---
std::multimap 按照key遍历
基于 ggplot2 中多个基因表达的颜色 UMAP