首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >r:根据多数规则从NbClust()检索最佳集群数,而无需查看控制台

r:根据多数规则从NbClust()检索最佳集群数,而无需查看控制台
EN

Stack Overflow用户
提问于 2016-05-18 05:54:43
回答 1查看 1.3K关注 0票数 1

我在一维数据上运行NbClust()

代码语言:javascript
运行
复制
nc <- NbClust(df, distance="euclidean", min.nc=2, max.nc=10, method="complete")

并在我的控制台上获得以下输出:

代码语言:javascript
运行
复制
[1] "Frey index : No clustering structure in this data set"
*** : The Hubert index is a graphical method of determining the number of clusters.
                In the plot of Hubert index, we seek a significant knee that corresponds to a 
                significant increase of the value of the measure i.e the significant peak in Hubert
                index second differences plot. 

*** : The D index is a graphical method of determining the number of clusters. 
                In the plot of D index, we seek a significant knee (the significant peak in Dindex
                second differences plot) that corresponds to a significant increase of the value of
                the measure. 

******************************************************************* 
* Among all indices:                                                
* 1 proposed 4 as the best number of clusters 
* 1 proposed 8 as the best number of clusters 
* 2 proposed 9 as the best number of clusters 
* 2 proposed 10 as the best number of clusters 

                   ***** Conclusion *****                            

* According to the majority rule, the best number of clusters is  9 


*******************************************************************

如果不查看,如何检索值"9“(在上面输出的最后一行)?

谢谢!

标准化数据如下:

代码语言:javascript
运行
复制
df <- structure(list(V1 = c(-0.142196220923589, 4.3271395706369, 5.00420146139183, 
    -0.292948282536991, -0.292948282536991, -0.292948282536991, -0.191455118249021, 
    -0.292948282536991, -0.292948282536991, -0.292948282536991, 1.04365387777657, 
    0.150712390018241, -0.275757257967042, -0.292948282536991, -0.292948282536991, 
    0.00392748792098075, -0.0235120320656692, 0.150712390018241, 
    -0.292948282536991, 0.22278245456149, -0.292948282536991, -0.292948282536991, 
    0.0888908208916921, -0.292948282536991, -0.269806518692829, -0.292948282536991, 
    -0.292948282536991, -0.292948282536991, -0.292948282536991, -0.287328139889123, 
    -0.030454561218918, 0.25980927671215, -0.292948282536991, -0.223192394378158, 
    -0.292948282536991, -0.292948282536991, -0.292948282536991, 0.0657490570475295, 
    -0.292948282536991, -0.292948282536991, -0.292948282536991, -0.215258075345874, 
    0.0862460478809306, 0.0862460478809306, -0.522051744594201, -0.518084585078059, 
    -0.496595804365622, -0.522051744594201, -0.516431601946333, -0.518084585078059
    )), .Names = "V1", row.names = c(NA, -50L), class = "data.frame")
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-18 08:20:37

多亏了zx8754,我发现以下内容从控制台输出中产生了所需的值

代码语言:javascript
运行
复制
length(unique(nc$Best.partition))
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37291347

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档