Optional 2
This commit is contained in:
parent
8135395500
commit
cadea6e1d4
@ -1 +1 @@
|
||||
,noah,NovaArchSys,30.09.2022 12:52,file:///home/noah/.config/libreoffice/4;
|
||||
,noah,NovaArchSys,30.09.2022 13:06,file:///home/noah/.config/libreoffice/4;
|
||||
@ -146,3 +146,28 @@ rownames(d)
|
||||
mddTree = hclust(as.dist(d))
|
||||
mddTree$labels <- phenos.df$X
|
||||
plot(mddTree)
|
||||
|
||||
|
||||
#### Optional 2: Compare MDS and UMAP clustering
|
||||
if (!require("umap")) install.packages("umap")
|
||||
library(umap)
|
||||
# change umap config parameters
|
||||
custom.config = umap.defaults
|
||||
custom.config$random_state = 123
|
||||
custom.config$n_epochs = 500
|
||||
|
||||
SxG.df <- data.frame(t(GxS.covfilter))
|
||||
|
||||
obs_mds = cmdscale(d, k=2)
|
||||
#add colors for MDD/HC
|
||||
colors = rep("black",nrow(SxG.df))
|
||||
colors[startsWith(rownames(SxG.df),"MDD")] <- "red"
|
||||
plot(obs_mds, col=colors,
|
||||
main="mds of observations", xlab="mds dim1", ylab="mds dim2")
|
||||
|
||||
obs_umap = umap(SxG.df, config=custom.config)
|
||||
#add colors for MDD/HC
|
||||
colors = rep("black",nrow(SxG.df))
|
||||
colors[startsWith(rownames(SxG.df),"MDD")] <- "red"
|
||||
plot(obs_umap$layout, col=colors,
|
||||
main="umap of observations", xlab="umap dim1", ylab="umap dim2")
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user