yanwu2014 / swne

Similarity Weighted Nonnegative Embedding (SWNE), a method for visualizing high dimensional datasets
BSD 3-Clause "New" or "Revised" License
103 stars 20 forks source link

Same code, different SWNE imbeddings #24

Closed hgb1111 closed 5 years ago

hgb1111 commented 5 years ago

Hi,

I'm running into an interesting problem where each iteration that I run the same code, I get a subtly different output. Am I leaving a critical argument out of the command that will correct for this?


load("path/Idents_ordered_ma_v6_res0.75.Robj")

obj <- Idents_ordered_ma_v6_res0.75
obj1 <- Idents_ordered_ma_v6_res0.75
obj2 <- Idents_ordered_ma_v6_res0.75
obj3 <- Idents_ordered_ma_v6_res0.75
obj4 <- Idents_ordered_ma_v6_res0.75
obj5 <- Idents_ordered_ma_v6_res0.75

#Obj
obj <- RunSWNE(obj, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj, reduction = "swne")

obj dimplot.pdf

#Obj1 
obj1 <- RunSWNE(obj1, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj1, reduction = "swne")

obj1 dimplot.pdf

#obj2 
obj2 <- RunSWNE(obj2, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj2, reduction = "swne")

obj2 dimplot.pdf

#obj3 
obj3 <- RunSWNE(obj3, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj3, reduction = "swne")

obj3 dimplot.pdf

#obj4 
obj4 <- RunSWNE(obj4, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj4, reduction = "swne")

obj4 dimplot.pdf

#obj5 
obj5 <- RunSWNE(obj5, k = 14, genes.embed = genes.embed, return.format = "seurat")
DimPlot(obj5, reduction = "swne")

obj5 dimplot.pdf

Thanks!

yanwu2014 commented 5 years ago

Ah unfortunately there are some stochastic elements to both the NMF and sammon mapping. By default it should be initializing the NMF so that the plot looks roughly the same every time, but currently there is no way to make it look exactly the same