generate_projections.R 795 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env Rscript
  2. library(cluster)
  3. library(mp)
  4. data <- read.csv2("../app/data/proj/projection_data.csv")
  5. m <- daisy(data)
  6. #Generate projections with geography information
  7. tsne_proj <- tSNE(m)
  8. lamp_proj <- lamp(m)
  9. lsp_proj <- lsp(m)
  10. saveRDS(tsne_proj, "../app/data/rds/proj_with_geography_tsne.rds")
  11. saveRDS(lamp_proj, "../app/data/rds/proj_with_geography_lamp.rds")
  12. saveRDS(lsp_proj, "../app/data/rds/proj_with_geography_lsp.rds")
  13. #Generate projections without geography information
  14. data <- data[-c(1,2,3,4,5,6)]
  15. m <- daisy(data)
  16. tsne_proj <- tSNE(m)
  17. lamp_proj <- lamp(m)
  18. lsp_proj <- lsp(m)
  19. saveRDS(tsne_proj, "../app/data/rds/proj_no_geography_tsne.rds")
  20. saveRDS(lamp_proj, "../app/data/rds/proj_no_geography_lamp.rds")
  21. saveRDS(lsp_proj, "../app/data/rds/proj_no_geography_lsp.rds")