基本的に、私は何千ものデータセットをシミュレートし、k 平均法、モデルベースのクラスタリングなどのさまざまなクラスタリング手法を使用してそれらをクラスタリングします。
次に、分類正解率 CCR を使用してメソッドのパフォーマンスを検証できます。ただし、ラベルの切り替えの問題に直面しているため、現実的な CCR を取得できません。それで、私の質問は、多変量データセットの r のすべてのラベルを統一する方法はありますか?
簡単な例を次に示します。
# Create the random data sets:
data1 <- rnorm(5, 0, 0.5) # cluster 1
data2 <- rnorm(5, 2, 0.5) # cluster 2
data3 <- rnorm(5, 4, 0.5) # cluster 3
alldata <- c(data1, data2, data3)
# cluster the data using different methods:
require(cluster)
km.method <- kmeans(alldata, centers = 3)$cluster
# [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2
pam.method <- pam(alldata, 3)$clustering
# [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3
# As you see the answers are exactly the same, but the labels are different!
# How I can unify the labels for all methods to match the true labels??