• R语言
  • 【求助】Fuzzy C-means Clusterings of R

给定一个数组 --> @x 做聚类分析,现在不知道它能分成多少类,是要做 fuzzy C-means clustering么?



  我在R上安装了 e1071,里面有cmeans这个聚类分析工具,但是当我导入并计算的时候,发现这个工具也必须要告诉它分成几类。



  请问,如何在R中实现 未知分类数目的聚类分析?



注:Fuzzy C-Means Clustering ----> cmeans Description:



Description

The fuzzy version of the known kmeans clustering algorithm as well as an on-line variant (Unsupervised Fuzzy Competitive learning).



Usage

cmeans(x, centers, iter.max = 100, verbose = FALSE,

    dist = "euclidean", method = "cmeans", m = 2,

    rate.par = NULL, weights = 1, control = list())



Arguments

x The data matrix where columns correspond to variables and rows to observations.

centers Number of clusters or initial values for cluster centers.

iter.max Maximum number of iterations.

verbose If TRUE, make some output during learning.

dist Must be one of the following: If "euclidean", the mean square error, if "manhattan", the mean absolute error is computed. Abbreviations are also accepted.

method If "cmeans", then we have the c-means fuzzy clustering method, if "ufcl" we have the on-line update. Abbreviations are also accepted.

m A number greater than 1 giving the degree of fuzzification.

rate.par A number between 0 and 1 giving the parameter of the learning rate for the on-line variant. The default corresponds to 0.3.

weights a numeric vector with non-negative case weights. Recycled to the number of observations in x if necessary.

control a list of control parameters. See Details.
请你告诉大家,如果类数未知,那么多少类算是合适的?或者更明确地说,你认为类数的评判准则是什么?
[quote]引用第1楼谢益辉2009-03-24 21:27发表的“”:

请你告诉大家,如果类数未知,那么多少类算是合适的?或者更明确地说,你认为类数的评判准则是什么?[/quote]



我现在的数据都是正整数,如下:

492, 500, 490, 486, 490, 491, 493, 480, 461, 504, 476, 434, 500, 470, 495, 3116, 3805, 3142, 12836, 12692, 3062, 3091, 3141, 3177, 3685, 3150, 3114, 3149, 12658, 3134, 3143, 3156, 3119, 3172, 3113, 12307, 12338, 3162, 2679, 3177, 3111, 3115, 3136, 3156, 12394, 3129, 3176, 3134, 3108, 12657, 506, 473, 495, 494, 434, 459, 445, 475, 476, 3146, 2009, 3132, 3155, 2704, 3125, 3170, 3187



具体分类的话,可以应用这个链接下的公式:

http://home.dei.polimi.it/matteucc/Clustering/tutorial_html/cmeans.html



使得 Jm 最小。



这个是我能想到的,最简单也有效的方法



如果各位大虾有更好的方法,或者更优秀的方法,请不辞告知,谢谢:)
自动确定 cluster 数目的算法最终结果都 有些怪。

本身 cluster 算法主要用于前期理解数据,跟可能分几类比较好的问题较劲,实在没必要。
[quote]引用第3楼bjt2009-03-25 10:00发表的“”:

自动确定 cluster 数目的算法最终结果都 有些怪。

本身 cluster 算法主要用于前期理解数据,跟可能分几类比较好的问题较劲,实在没必要。[/quote]



数据可以做如下解析:



首先,理论上数据可以分成1类,或者2类,这个在每行数据里是不固定的。即某些行可以分成一类,有些行可以分成两类,但是哪些行分成1类那些行分成两类不固定



但是,由于有实验误差的问题,有些数据需要抛弃,比如,如果一组数据是 23,24,25,332,334,336,2000; 那么这个2000是实验误差,需要摒弃。一般来讲这个误差会是非常大的,比如这里是2000,或者更大,30000;同时误差的个数不固定,有时候是一个2000,有时候是一个2000,一个30000。这里取决于这一行包含数据的个数。数据个数越多,其中包含错误的个数便越多。



  如果让我来手工分类,基本上就是按照上面的方式;首先确定是一个cluster或者是两个clusters,然后再摒弃掉距离cluster距离非常远的数字。



  这里如果是一个cluster,则这个cluster附近的数字符合正态分布;如果是两个cluster,那么在这两个cluster附近的数字分别符合正态分布。



  如何来模拟上面的手工分类过程?