数据:文件 iris.txt
中包含了 iris
数据,其中每行的前四个数据代表一个样本,最后一个数据表示该样本的类别。
-
用C-means的方法对iris数据作聚类,要求聚成 3类。要求给出下列数据:
- 初始类中心点
- 迭代次数
- 聚类结果(每类包含的样本,类中心)
- 错误率
-
用谱聚类方法对
iris
数据作聚类 -
递交实验报告,源代码
运行 Fuzzy c-means
$ cd .\cmeans\
$ python .\cmeans.py
运行 Spectral
$ cd .\spectral\
$ pip install -r .\requirements.txt
$ python .\spectral.py
令:
我们认为一个好的聚类应该意味着总距离尽可能的小
于是问题变为:在约束条件 下,求 。这个优化问题通常使用交互式策略求解,即给定 关于 求最小,再给定 关于 求最小。
使用拉格朗日乘数法计算得到:
伪码如下:
设置模糊参数 m、误差阈值 precise、随机初始化聚类中心点 C[]
loop:
计算最优隶属度矩阵 U[][]
根据隶属度矩阵计算新的聚类中心点 C'[]
if C[] 和 C'[] 的距离 < 误差阈值 precise:
将 C 更新为 C‘
break
将 C 更新为 C‘
用 C 对样本进行分类
见 cmeans.py
以下输出包含:初始类中心点、迭代次数、聚类结果(每类包含的样本,类中心)、正确率
计算得错误率 = 1 - 正确率 = 0.106667
(ml) PS D:\Projects\cluster> python .\cmeans.py
初始类中心点
[5.199999999999999, 3.6, 1.5, 0.30000000000000004] 0.0
[7.1, 3.3000000000000003, 4.8, 1.5] 1.0
[6.3999999999999995, 3.4, 6.1, 2.6] 2.0
在第15次迭代时收敛
聚类后的类中心
[5.003966319284148, 3.4140814490387914, 1.4828276178642037, 0.2535517357359567] 0.0
[5.889081869565415, 2.7611232276170203, 4.364170157821359, 1.3974276857268302] 1.0
[6.77519207409717, 3.052434885440432, 5.647007100459471, 2.0536335619897863] 2.0
聚类准确率为0.893333
聚类的结果如下
属于第0.0类的样本有
[5.1, 3.5, 1.4, 0.2] 0.0
[4.9, 3.0, 1.4, 0.2] 0.0
[4.7, 3.2, 1.3, 0.2] 0.0
[4.6, 3.1, 1.5, 0.2] 0.0
[5.0, 3.6, 1.4, 0.2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.8] 2.0
[7.7, 3.8, 6.7, 2.2] 2.0
[7.7, 2.6, 6.9, 2.3] 2.0
[6.9, 3.2, 5.7, 2.3] 2.0
[7.7, 2.8, 6.7, 2.0] 2.0
[6.7, 3.3, 5.7, 2.1] 2.0
[7.2, 3.2, 6.0, 1.8] 2.0
[6.4, 2.8, 5.6, 2.1] 2.0
[7.2, 3.0, 5.8, 1.6] 2.0
[7.4, 2.8, 6.1, 1.9] 2.0
[7.9, 3.8, 6.4, 2.0] 2.0
[6.4, 2.8, 5.6, 2.2] 2.0
[6.1, 2.6, 5.6, 1.4] 2.0
[7.7, 3.0, 6.1, 2.3] 2.0
[6.3, 3.4, 5.6, 2.4] 2.0
[6.4, 3.1, 5.5, 1.8] 2.0
[6.9, 3.1, 5.4, 2.1] 2.0
[6.7, 3.1, 5.6, 2.4] 2.0
[6.9, 3.1, 5.1, 2.3] 2.0
[6.8, 3.2, 5.9, 2.3] 2.0
[6.7, 3.3, 5.7, 2.5] 2.0
[6.7, 3.0, 5.2, 2.3] 2.0
[6.5, 3.0, 5.2, 2.0] 2.0
[6.2, 3.4, 5.4, 2.3] 2.0
定义问题:
分析问题:
将样本视为一组点,点与点之间的联系视为带权值的边,则可以构造出一个图 其中 ,聚类的过程就转化为对图的一种划分(切图),将样本聚为 类等价于将图 切成 个子图:
一个好的聚类意味着子图之间的联系尽可能少,子图内部的点聚合度尽可能高
再定义:
再分析问题:
再定义:
-
对于切图中的某个子图 ,我们对它定义一个 n 维(n为样本数)的指示(列)向量 ,如果点 属于子图 ,则指示向量 的第 个元素 等于 ,即:
怎么发现的见附录
再分析问题:
所以要最小化的目标:
问题变成求解:
我们要求出 最小的前 k 个特征值。一般来说,k 远小于 n,也就是说将从 n 维降到了 k 维。另外, 相当于对 做了标准化:
接着求出对应的 k 个特征向量,可以得到一个 n×k 的矩阵,即为我们的 。
由于我们在使用维度规约的时候损失了少量信息,导致得到的优化后的指示向量 h 对应的 现在不能完全指示各样本的归属,因此一般在得到 n×k 的矩阵 后还需要对每一行进行一次传统的聚类,比如使用 K-Means 。
- 构建邻接矩阵 W,度矩阵 D,计算出拉普拉斯矩阵 L
- 构建标准化后的拉普拉斯矩阵
- 计算 最小的 k 个特征值所各自对应的特征向量 f
- 将各自对应的特征向量 f 组成的矩阵按行标准化,最终组成 n×k 维的特征矩阵 F
- 把 F 中的每一行作为一个 k 维的样本,共 n 个样本,用传统聚类方法进行聚类,聚类维数为 K
- 得到簇划分。
见 spectral.py
标准化后的拉普拉斯矩阵:
[[ 0.94760147 0. 0. ... 0. 0.
0. ]
[ 0. 0.9124808 -0.07256349 ... 0. 0.
0. ]
[ 0. -0.07256349 0.93417065 ... 0. 0.
0. ]
...
[ 0. 0. 0. ... 0.9315538 -0.07011117
0. ]
[ 0. 0. 0. ... -0.07011117 0.89498362
0. ]
[ 0. 0. 0. ... 0. 0.
0.91567561]]
前 3 个最小的特征值:
[(-5.551115123125783e-17, 0), (1.214306433183765e-16, 50), (0.019842972248943297, 51)]
前 %d 个最小的特征值对应的特征向量:
[[-0.16906564 0.10816728 -0.15672531 -0.13092652 -0.0490668 0.08781605
0.06457376 -0.04246249 0.11012205 0.00328772 0.36972239 0.0194687
0.1895311 -0.10465268 -0.1244069 0.02046343 -0.04346536 0.02242108
0.1164522 -0.03286019 0.03175442 0.09528833 -0.0135314 0.10715087
-0.03400193 -0.16064558 -0.00453491 0.04555546 -0.02760322 -0.26332282
-0.28866898 -0.18933231 -0.00156389 -0.13418623 -0.09859749 0.15621798
-0.3753152 -0.30066783 -0.15279305 0.048503 -0.01907583 -0.00132372
-0.05783982 0.14763368 0.27460392 -0.1000876 0.09770901 0.0441368
-0.03487257 -0.00889804 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. ]
[-0.13081671 -0.15612145 0.01066228 0.26777019 -0.02883947 0.18248695
0.24215817 -0.05770441 -0.0157502 0.10591291 0.07574946 -0.08797724
-0.17008025 -0.04200753 0.08909346 -0.07950693 0.08998358 -0.04573212
0.24510485 -0.00094442 0.08759288 0.12942972 0.23513007 -0.02795797
-0.28698108 0.14814041 0.08243547 0.06133251 -0.5027385 0.06759108
0.04861763 -0.01020471 -0.04203467 0.04115469 -0.12280525 0.07634075
-0.05732899 0.03683833 0.11128786 0.15137554 0.21586559 -0.18696691
0.0834821 -0.04903204 0.05434949 0.03377982 0.01855217 -0.15843772
0.06962382 0.07529264 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. ]
[-0.15083604 -0.20011291 0.07194666 -0.07769783 -0.00252465 0.11929617
0.01122155 0.31393715 -0.0306828 -0.09223113 -0.05934368 0.17460319
0.13831238 0.16024527 -0.2324454 0.01138916 -0.0092682 0.05096698
-0.09431016 -0.18375396 -0.08024428 -0.16203505 -0.14031008 -0.094478
0.27479935 0.09022724 0.00139943 -0.13361664 0.02284891 0.03650127
-0.09096278 -0.03098912 -0.16999457 -0.07214325 -0.21963327 0.28970899
0.04043035 0.02244718 0.33441921 0.07838977 0.07737128 -0.12162577
0.00459616 0.00859246 0.12234634 0.1075786 0.08370802 -0.28698959
0.11609811 0.12139216 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. ]]
特征矩阵:
[[-1.69065640e-01 0.00000000e+00 0.00000000e+00]
[-1.30816712e-01 0.00000000e+00 0.00000000e+00]
[-1.50836039e-01 0.00000000e+00 0.00000000e+00]
[-1.50378236e-01 0.00000000e+00 0.00000000e+00]
[-1.51228227e-01 0.00000000e+00 0.00000000e+00]
[-1.33322622e-01 0.00000000e+00 0.00000000e+00]
[-1.39693150e-01 0.00000000e+00 0.00000000e+00]
[-1.65027995e-01 0.00000000e+00 0.00000000e+00]
[-1.29046567e-01 0.00000000e+00 0.00000000e+00]
[-1.37074119e-01 0.00000000e+00 0.00000000e+00]
[-1.48774520e-01 0.00000000e+00 0.00000000e+00]
[-1.25906123e-01 0.00000000e+00 0.00000000e+00]
[-1.54484980e-01 0.00000000e+00 0.00000000e+00]
[-1.25643645e-01 0.00000000e+00 0.00000000e+00]
[-1.18248578e-01 0.00000000e+00 0.00000000e+00]
[-1.15384152e-01 0.00000000e+00 0.00000000e+00]
[-1.33302748e-01 0.00000000e+00 0.00000000e+00]
[-1.61326453e-01 0.00000000e+00 0.00000000e+00]
[-1.26011215e-01 0.00000000e+00 0.00000000e+00]
[-1.61687718e-01 0.00000000e+00 0.00000000e+00]
[-1.29377262e-01 0.00000000e+00 0.00000000e+00]
[-1.50827010e-01 0.00000000e+00 0.00000000e+00]
[-1.19658848e-01 0.00000000e+00 0.00000000e+00]
[-1.34295154e-01 0.00000000e+00 0.00000000e+00]
[-1.22481374e-01 0.00000000e+00 0.00000000e+00]
[-1.34599284e-01 0.00000000e+00 0.00000000e+00]
[-1.41537997e-01 0.00000000e+00 0.00000000e+00]
[-1.69394298e-01 0.00000000e+00 0.00000000e+00]
[-1.42510202e-01 0.00000000e+00 0.00000000e+00]
[-1.55000157e-01 0.00000000e+00 0.00000000e+00]
[-1.45393286e-01 0.00000000e+00 0.00000000e+00]
[-1.30026853e-01 0.00000000e+00 0.00000000e+00]
[-1.31819480e-01 0.00000000e+00 0.00000000e+00]
[-1.21709499e-01 0.00000000e+00 0.00000000e+00]
[-1.47321098e-01 0.00000000e+00 0.00000000e+00]
[-1.30124763e-01 0.00000000e+00 0.00000000e+00]
[-1.33948687e-01 0.00000000e+00 0.00000000e+00]
[-1.45569976e-01 0.00000000e+00 0.00000000e+00]
[-1.29424777e-01 0.00000000e+00 0.00000000e+00]
[-1.64906163e-01 0.00000000e+00 0.00000000e+00]
[-1.55920394e-01 0.00000000e+00 0.00000000e+00]
[-1.10867882e-01 0.00000000e+00 0.00000000e+00]
[-1.33794414e-01 0.00000000e+00 0.00000000e+00]
[-1.29276702e-01 0.00000000e+00 0.00000000e+00]
[-1.22043520e-01 0.00000000e+00 0.00000000e+00]
[-1.54380873e-01 0.00000000e+00 0.00000000e+00]
[-1.48352457e-01 0.00000000e+00 0.00000000e+00]
[-1.41439492e-01 0.00000000e+00 0.00000000e+00]
[-1.70547921e-01 0.00000000e+00 0.00000000e+00]
[-1.56000486e-01 0.00000000e+00 0.00000000e+00]
[ 0.00000000e+00 -8.92192209e-02 -1.92146575e-02]
[ 0.00000000e+00 -9.87751752e-02 -3.32238252e-02]
[ 0.00000000e+00 -8.98822021e-02 -1.88482911e-02]
[ 0.00000000e+00 -1.08636196e-01 -1.39353670e-01]
[ 0.00000000e+00 -1.21356911e-01 -3.14896392e-02]
[ 0.00000000e+00 -1.02276687e-01 -9.92187557e-02]
[ 0.00000000e+00 -9.74148319e-02 -2.98008180e-02]
[ 0.00000000e+00 -8.41257105e-02 -1.13786482e-01]
[ 0.00000000e+00 -1.02503769e-01 -3.35826306e-02]
[ 0.00000000e+00 -1.03547763e-01 -1.33059710e-01]
[ 0.00000000e+00 -8.36850546e-02 -1.12933864e-01]
[ 0.00000000e+00 -9.91931169e-02 -8.97633730e-02]
[ 0.00000000e+00 -9.13884600e-02 -1.02798241e-01]
[ 0.00000000e+00 -1.09531289e-01 -3.72869732e-02]
[ 0.00000000e+00 -9.49252193e-02 -1.24153519e-01]
[ 0.00000000e+00 -9.13953628e-02 -2.77165392e-02]
[ 0.00000000e+00 -9.79267337e-02 -1.00030935e-01]
[ 0.00000000e+00 -1.09400226e-01 -1.35420948e-01]
[ 0.00000000e+00 -8.65317644e-02 -2.68373983e-02]
[ 0.00000000e+00 -1.13389671e-01 -1.47899067e-01]
[ 0.00000000e+00 -9.06753630e-02 -2.45553614e-02]
[ 0.00000000e+00 -9.80333812e-02 -9.85729183e-02]
[ 0.00000000e+00 -1.01265110e-01 -1.21522341e-02]
[ 0.00000000e+00 -9.77047823e-02 -3.86561984e-02]
[ 0.00000000e+00 -9.89651340e-02 -4.36701167e-02]
[ 0.00000000e+00 -9.91787038e-02 -3.11218223e-02]
[ 0.00000000e+00 -9.06770895e-02 -1.48128678e-02]
[ 0.00000000e+00 -9.77258602e-02 3.10741569e-02]
[ 0.00000000e+00 -1.12435895e-01 -6.34250448e-02]
[ 0.00000000e+00 -1.01127893e-01 -1.33788318e-01]
[ 0.00000000e+00 -1.10394108e-01 -1.44859638e-01]
[ 0.00000000e+00 -1.06796520e-01 -1.40796536e-01]
[ 0.00000000e+00 -1.13626239e-01 -1.42083076e-01]
[ 0.00000000e+00 -1.09027305e-01 1.62647191e-03]
[ 0.00000000e+00 -9.32088957e-02 -9.96336868e-02]
[ 0.00000000e+00 -8.95884770e-02 -4.01821652e-02]
[ 0.00000000e+00 -9.23342021e-02 -1.99987915e-02]
[ 0.00000000e+00 -8.74512807e-02 -4.02727759e-02]
[ 0.00000000e+00 -1.06510529e-01 -1.24146744e-01]
[ 0.00000000e+00 -1.15726377e-01 -1.48502003e-01]
[ 0.00000000e+00 -9.78728313e-02 -1.15119945e-01]
[ 0.00000000e+00 -1.06483859e-01 -4.34847803e-02]
[ 0.00000000e+00 -1.16839225e-01 -1.45760610e-01]
[ 0.00000000e+00 -8.52412114e-02 -1.15114665e-01]
[ 0.00000000e+00 -1.16533062e-01 -1.40814531e-01]
[ 0.00000000e+00 -1.03482996e-01 -1.18634535e-01]
[ 0.00000000e+00 -1.10876203e-01 -1.24318892e-01]
[ 0.00000000e+00 -1.02593902e-01 -4.92833732e-02]
[ 0.00000000e+00 -8.18492595e-02 -1.10748617e-01]
[ 0.00000000e+00 -1.23008999e-01 -1.47351333e-01]
[ 0.00000000e+00 -8.73561344e-02 1.12770677e-01]
[ 0.00000000e+00 -1.01643809e-01 -3.21351509e-03]
[ 0.00000000e+00 -1.10283292e-01 1.56484641e-01]
[ 0.00000000e+00 -9.44354052e-02 8.93926467e-02]
[ 0.00000000e+00 -1.08665976e-01 1.33759250e-01]
[ 0.00000000e+00 -8.50754907e-02 1.29074666e-01]
[ 0.00000000e+00 -8.02898456e-02 -8.00422326e-02]
[ 0.00000000e+00 -9.42388620e-02 1.38394854e-01]
[ 0.00000000e+00 -9.59280996e-02 1.09543830e-01]
[ 0.00000000e+00 -8.75384023e-02 1.26548001e-01]
[ 0.00000000e+00 -9.43812996e-02 9.17979941e-02]
[ 0.00000000e+00 -1.01791400e-01 6.71373928e-02]
[ 0.00000000e+00 -1.26722161e-01 1.55036660e-01]
[ 0.00000000e+00 -9.20514411e-02 -1.20067524e-02]
[ 0.00000000e+00 -8.63893541e-02 1.65098833e-03]
[ 0.00000000e+00 -1.04413599e-01 1.16838478e-01]
[ 0.00000000e+00 -1.08273555e-01 1.12162476e-01]
[ 0.00000000e+00 -7.55464034e-02 1.14805114e-01]
[ 0.00000000e+00 -7.51263282e-02 1.14297061e-01]
[ 0.00000000e+00 -9.07018166e-02 -4.48529533e-03]
[ 0.00000000e+00 -1.15100002e-01 1.55955897e-01]
[ 0.00000000e+00 -9.29656757e-02 -1.46751586e-02]
[ 0.00000000e+00 -8.20473518e-02 1.24247957e-01]
[ 0.00000000e+00 -1.12083036e-01 5.53634615e-03]
[ 0.00000000e+00 -1.13580072e-01 1.48203571e-01]
[ 0.00000000e+00 -1.03284019e-01 1.49467021e-01]
[ 0.00000000e+00 -1.17826459e-01 -1.59569885e-02]
[ 0.00000000e+00 -1.12349953e-01 -6.68139214e-03]
[ 0.00000000e+00 -9.88185729e-02 1.09185424e-01]
[ 0.00000000e+00 -9.37081811e-02 1.29615129e-01]
[ 0.00000000e+00 -9.42849887e-02 1.38224215e-01]
[ 0.00000000e+00 -7.79712203e-02 1.17903343e-01]
[ 0.00000000e+00 -1.04768340e-01 1.18555027e-01]
[ 0.00000000e+00 -1.08035340e-01 7.97688438e-03]
[ 0.00000000e+00 -8.56510025e-02 4.15288215e-02]
[ 0.00000000e+00 -8.98049446e-02 1.34513766e-01]
[ 0.00000000e+00 -8.96486755e-02 1.15405692e-01]
[ 0.00000000e+00 -1.04556189e-01 1.11153949e-01]
[ 0.00000000e+00 -1.12412376e-01 -2.10137921e-02]
[ 0.00000000e+00 -1.04743674e-01 1.32540338e-01]
[ 0.00000000e+00 -1.14993132e-01 1.47510353e-01]
[ 0.00000000e+00 -8.92347669e-02 1.00812772e-01]
[ 0.00000000e+00 -9.86084377e-02 -6.36170881e-03]
[ 0.00000000e+00 -1.03685594e-01 1.41706088e-01]
[ 0.00000000e+00 -9.77899770e-02 1.28179689e-01]
[ 0.00000000e+00 -9.10048460e-02 1.07508989e-01]
[ 0.00000000e+00 -1.00406027e-01 -4.37014531e-05]
[ 0.00000000e+00 -1.09487385e-01 1.07395741e-01]
[ 0.00000000e+00 -8.83914491e-02 1.07021833e-01]
[ 0.00000000e+00 -9.86420695e-02 -7.58702211e-03]]
得到的簇划分:
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 2 2 1 2 2 2 2
2 2 1 1 2 2 2 2 1 2 1 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 2
2 1]
聚类准确率为:0.9
- https://blog.csdn.net/changyuanchn/article/details/80427893
- https://en.wikipedia.org/wiki/Fuzzy_clustering
- https://zhuanlan.zhihu.com/p/85244505
- https://www.bilibili.com/video/BV1kt411X7Zh
- https://www.cnblogs.com/pinard/p/6221564.html