在R中使用sparcl包在R中執行稀疏分級集羣時,我無法獲得數據的集羣標籤。在幫助文檔,它們具有以下代碼:如何獲取R中HierarchicalSparseCluster()中的集羣標籤
# Generate 2-class data
set.seed(1)
x <- matrix(rnorm(100*50),ncol=50)
y <- c(rep(1,50),rep(2,50))
x[y==1,1:25] <- x[y==1,1:25]+2
# Do tuning parameter selection for sparse hierarchical clustering
perm.out <- HierarchicalSparseCluster.permute(x, wbounds=c(1.5,2:6), nperms = 5)
# Perform sparse hierarchical clustering
sparsehc <- HierarchicalSparseCluster(dists=perm.out$dists,
wbound=perm.out$bestw, method="complete")
現在,我怎麼從對象sparsehc到簇標籤是我的問題?
對於Kmeans,我們創建了一個簡單的屬性「cs」。例如。
## Choosing tuning parameters
km.perm <- KMeansSparseCluster.permute(data_mat, K = 10, wbounds= seq(3,7, len =
20), nperms=5)
## Performing kmean sparce clustring
sparse_data_clus <- KMeansSparseCluster(data_mat, K = 10, wbounds= km.perm$bestw)
clusterlabel <- sparse_data_clus[[1]]$Cs
我怎樣才能HierarchicalSparseCluster()得到類似的標籤?
謝謝!