3
는 I 클러스터링 시퀀스 기반의 데이터에 대한 이러한 함수를 작성한 :결정 이상적인 번호 - 기반 클러스터링
library(TraMineR)
library(cluster)
clustering <- function(data){
data <- seqdef(data, left = "DEL", gaps = "DEL", right = "DEL")
couts <- seqsubm(data, method = "CONSTANT")
data.om <- seqdist(data, method = "OM", indel = 3, sm = couts)
clusterward <- agnes(data.om, diss = TRUE, method = "ward")
(clusterward)
}
rc <- clustering(rubinius_sequences)
cluster_cut <- function(data, clusterward, n_clusters, name_clusters){
data <- seqdef(data, left = "DEL", gaps = "DEL", right = "DEL")
cluster4 <- cutree(clusterward, k = n_clusters)
cluster4 <- factor(cluster4, labels = c("Type 1", "Type 2", "Type 3", "Type 4"))
(data[cluster4==name_clusters,])
}
rc1 <- cluster_cut(project_sequences, rc, 4, "Type 1")
그러나, 여기서 클러스터의 개수는 임의로 할당된다. 특정 수의 클러스터에 의해 포착 된 분산 (또는 비슷한 측정)의 양이 특정 수의 클러스터에서 수익을 감소시키는 지점에 도달하기 시작한다는 것을 보여줄 수있는 방법이 있습니까? 나는 scree plot in factor analysis과 비슷한 것을 상상하고 있습니다.