【发布时间】:2018-11-13 17:16:02
【问题描述】:
我想在一个包含 41 个变量和 415 个观察值的大型无监督数据集上使用模糊 C 均值聚类。但是,我一直在尝试验证这些集群。当我使用随机数量的集群进行绘图时,我可以解释总共 54% 的方差,这不是很好,并且没有像 iris 数据库那样真正好的集群。
首先我在 3 个集群上运行 fcm 与我的规模数据只是为了查看,但如果我试图找到搜索最佳集群数量的方法,那么我不想设置任意定义的数量集群。
所以我转向谷歌并在谷歌上搜索:“验证 R 中的模糊聚类。” This link here was good,但我仍然需要尝试一堆不同数量的集群。我查看了advclust、ppclust 和clvalid 包,但找不到这些功能的演练。我查看了每个包的文档,但也无法辨别下一步该做什么。
我浏览了一些可能数量的集群,并使用来自 fanny 的 k.crisp 对象检查了每个集群。我从 100 开始下降到 4。根据文档中的对象描述,
k.crisp=integer ( ≤ k ) 给出清晰簇的数量;可以小于 k , 建议减少 memb.exp.
这似乎不是一种有效的方法,因为它是将清晰集群的数量与我们的模糊集群进行比较。
是否有可以从2:10 集群检查集群有效性的功能?另外,检查 1 个集群的有效性是否值得?我认为这是一个愚蠢的问题,但我有一种奇怪的感觉 1 最佳集群可能是我得到的。 (如果我要获得 1 个集群,除了在里面哭一点之外,还有什么建议吗?)
代码
library(cluster)
library(factoextra)
library(ppclust)
library(advclust)
library(clValid)
data(iris)
df<-sapply(iris[-5],scale)
res.fanny<-fanny(df,3,metric='SqEuclidean')
res.fanny$k.crisp
# When I try to use euclidean, I get the warning all memberships are very close to 1/l. Maybe increase memb.exp, which I don't fully understand
# From my understanding using the SqEuclidean is equivalent to Fuzzy C-means, use the website below. Ultimately I do want to use C-means, hence I use the SqEuclidean distance
fviz_cluster(Res.fanny,ellipse.type='norm',palette='jco',ggtheme=theme_minimal(),legend='right')
fviz_silhouette(res.fanny,palette='jco',ggtheme=theme_minimal())
# With ppclust
set.seed(123)
res.fcm<-fcm(df,centers=3,nstart=10)
【问题讨论】:
标签: r validation cluster-analysis