Skip to content
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

Scaling of higher dimensions #1

Open
rcannood opened this issue Oct 13, 2019 · 1 comment
Open

Scaling of higher dimensions #1

rcannood opened this issue Oct 13, 2019 · 1 comment

Comments

@rcannood
Copy link
Member

The higher dimensions of LMDS have a higher scale in comparison to MDS and PCA. Determine whether this is a problem and whether it needs to be solved.

plot

Example code
library(tidyverse)
library(dyno)

data("fibroblast_reprogramming_treutlein")

expr <- fibroblast_reprogramming_treutlein$expression 
rownames(expr) <- colnames(expr) <- NULL

pca <- prcomp(expr, rank. = 40)$x %>% dynutils::scale_uniform()
pheatmap::pheatmap(pca, border_color = NA, cluster_cols = FALSE)

mds <- cmdscale(dynutils::calculate_distance(expr, method = "spearman"), k = 40) %>%
  dynutils::scale_uniform()
pheatmap::pheatmap(mds, border_color = NA, cluster_cols = FALSE)

lmds <- lmds::lmds(expr, distance_method = "spearman", ndim = 40, num_landmarks = 100) %>%
  dynutils::scale_uniform()
pheatmap::pheatmap(lmds, border_color = NA, cluster_cols = FALSE)

colnames(pca) <- colnames(mds) <- colnames(lmds) <- NULL

df <- bind_rows(
  pca %>% reshape2::melt(varnames = c("row", "comp")) %>% mutate(dimred = "PCA"),
  mds %>% reshape2::melt(varnames = c("row", "comp")) %>% mutate(dimred = "MDS"),
  lmds %>% reshape2::melt(varnames = c("row", "comp")) %>% mutate(dimred = "LMDS")
)
ggplot(df) + 
  geom_point(aes(comp, value, colour = dimred)) +
  facet_wrap(~dimred) +
  theme_bw()
ggsave("~/plot.png", width = 12, height = 4)
@rcannood
Copy link
Member Author

By setting the number of landmarks to Inf, this effect is already greatly reduced (as can be expected, maybe), but not entirely:

plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant