SHARE
TWEET

Untitled

a guest Jul 17th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inc = 36
  2.    ki = seq(1,18203, by=inc)
  3.  
  4.    for (i in 0:length(ki)) {
  5.  
  6.      Dat4 = Data4[ki[i+1]:ki[i+2],3:6]
  7.  
  8.      #CovMat = cov(Dat5)
  9.      #write.table(Dat5, file="CovMatrix.csv", sep = ",", col.names = F,
  10.      append = T)
  11.      #e = eigen(CovMat)
  12.      #EValue = CovMat$values
  13.      #write.table(EValue, file = "EigenValues.csv", sep = ",", col.names =
  14.      F, append = T)
  15.  
  16.      library(tidyverse)
  17.      library(cluster)
  18.      library(factoextra)
  19.      library(gridExtra)
  20.  
  21.      name2 = "F:/"
  22.      ext = ".pdf"
  23.      path4 = paste(name2,i,ext)
  24.      pdf(file=path4)
  25.  
  26.      library(fpc)
  27.      m<- kmeansruns(Dat4,krange = 1:8,criterion="asw", plot=F)
  28.      cust=m$bestk
  29.  
  30.      km = eclust(Dat4, FUNcluster = c("kmeans"), k = cust, graph = FALSE,
  31.      hc_metric = "euclidean")
  32.      f = fviz_cluster(km, geom = "point", ellipse.type = "norm",
  33.      ellipse.level = 0.68) + ggtitle("TrainingSet")
  34.  
  35.      CenterClust = km$centers
  36.      #Cente = c(k$centers)
  37.      #print(Cente)
  38.      write.table(CenterClust, file = "KMCC.csv", sep = ",", col.names = F,
  39.      append = T)
  40.  
  41.      grid.arrange(f, nrow = 2)
  42.  
  43.      dev.off()
  44.  
  45.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top