Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyCluster'重复应用的结果变化;s-K-Medoids_Python_Cluster Analysis - Fatal编程技术网

Python PyCluster'重复应用的结果变化;s-K-Medoids

Python PyCluster'重复应用的结果变化;s-K-Medoids,python,cluster-analysis,Python,Cluster Analysis,我在距离矩阵上应用kmedoids。当我打印数据的集群标签时,它会在列表中显示25次组合号。有时是2,25,26。有时是2,64,66。例如:(假设这是其中一个输出的统计信息) 所以,我想知道为什么每次我运行程序时标签号和项目号都会不断变化。K-medoids是一种随机算法,所以每次都会得到不同的结果 聚类数可能是medoid的索引。你看过pycluster的源代码了吗 import Pycluster as PC matrix=([ 0. , 1.47, 2.43, 3.44, 1.

我在距离矩阵上应用kmedoids。当我打印数据的集群标签时,它会在列表中显示25次组合号。有时是2,25,26。有时是2,64,66。例如:(假设这是其中一个输出的统计信息)


所以,我想知道为什么每次我运行程序时标签号和项目号都会不断变化。

K-medoids是一种随机算法,所以每次都会得到不同的结果

聚类数可能是medoid的索引。你看过pycluster的源代码了吗

import Pycluster as PC
matrix=([ 0.  ,  1.47,  2.43,  3.44,  1.08],
[ 1.47,  0.  ,  1.5 ,  2.39,  2.11],
[ 2.43,  1.5 ,  0.  ,  1.22,  2.69],
[ 3.44,  2.39,  1.22,  0.  ,  3.45],
[ 1.08,  2.11,  2.69,  3.45,  0.])
cluster,medoids,error=PC.kmedoids(matrix,3)
print(cluster)
2: 10 items

25:10 items

26:5 items