I want to run buckshot algorithm in R what combine hac(hierarchical clustering) with k-means clustering. so, I want to be select many center of k-means. For example, one of a cluster has three seed. This is my code,
iris data k-means
iristr <- read.csv("iristr.CSV", header = TRUE)
str(iristr)
iristr.m <- as.matrix(iristr[,1:4])
km <- kmeans(iristr.m, centers = 3)
km
table(km$cluster,iristr$Species)
iris data buckshot
irists <- read.csv("irists.csv", header = TRUE)
str(irists)
irists.m <- as.matrix(irists[,1:4])
dm <- dist(irists.m, method = "euclidean")
hc <- hclust(dm, method = "complete")
plot(hc)
clusterCut <- cutree(hc,3)
clusterCut
i1 <- iristr.m[c(1,4,12),] # one of cluster have many seed(center)
i1
i2 <- iristr.m[c(2,5,8),] # one of cluster have many seed(center)
i2
i3 <- iristr.m[c(3,6,7,9,10,11),] # one of cluster have many seed(center)
i3
buckshot <- kmeans(iristr.m, centers=i1,i2,i3) # realized only "i1" centers
buckshot
table(buckshot$cluster,iristr$Species)