【问题标题】:Clustering using Representatives (CURE)使用代表聚类 (CURE)
【发布时间】:2018-05-24 14:10:38
【问题描述】:

我需要一个数值示例来演示使用 CURE 算法进行聚类的工作原理。
https://www.cs.ucsb.edu/~veronika/MAE/summary_CURE_01guha.pdf

【问题讨论】:

  • 我需要花一大笔钱去牙买加度假……
  • 继续吧。没有人阻止你!
  • 小马。我需要小马。
  • 设得兰小马还是威尔士小马?

标签: algorithm cluster-analysis data-mining hierarchical-clustering


【解决方案1】:

pyclustering 库有许多带有示例的聚类算法,以及在其 Github 上的示例代码。 Here is a link the CURE example.

Googling Cure 算法示例也提出了一些问题。

希望对您有所帮助!

【讨论】:

  • 感谢您的回答。但我需要一个数值示例(显示随机抽样、计算距离 btn 簇、选择代表)。
【解决方案2】:

使用pyclustering库,您可以使用相应的方法提取有关代表点和均值的信息(链接到CURE pyclustering generated documentation):

# create instance of the algorithm
cure_instance = cure(<algorithm parameters>);

# start processing
cure_instance.process();

# get allocated clusteres
clusters = cure_instance.get_clusters();

# get representative points
representative = cure_instance.get_representors();

您还可以修改 CURE 算法的源代码以在每个步骤之后显示更改,例如,将它们打印到控制台甚至可视化。下面是一个示例,如何修改代码以显示每一步聚类的变化 (after line 219) 其中星表示代表点,小点 - 点本身,大点 - 表示:

# New cluster and updated clusters should relocated in queue
self.__insert_cluster(merged_cluster);
for item in cluster_relocation_requests:
    self.__relocate_cluster(item);
#
# ADD FOLLOWING PEACE OF CODE TO DISPLAY CHANGES ON EACH STEP
#
temp_clusters = [ cure_cluster_unit.indexes for cure_cluster_unit in self.__queue ];
temp_representors = [ cure_cluster_unit.rep for cure_cluster_unit in self.__queue ];
temp_means = [ cure_cluster_unit.mean for cure_cluster_unit in self.__queue ];

visualizer = cluster_visualizer();
visualizer.append_clusters(temp_clusters, self.__pointer_data);

for cluster_index in range(len(temp_clusters)):
    visualizer.append_cluster_attribute(0, cluster_index, temp_representors[cluster_index], '*', 7);
    visualizer.append_cluster_attribute(0, cluster_index, [ temp_means[cluster_index] ], 'o');

visualizer.show();

您将看到一系列图像,如下所示:

因此,您可以显示您需要的任何信息。

另外我想补充一点,您可以使用 C++ 实现的算法进行可视化(这也是 pyclustering 的一部分):https://github.com/annoviko/pyclustering/blob/master/ccore/src/cluster/cure.cpp

【讨论】:

    猜你喜欢
    • 2011-08-25
    • 1970-01-01
    • 2016-04-17
    • 2022-01-08
    • 2016-02-17
    • 2012-01-06
    • 2019-10-29
    • 2022-06-10
    • 1970-01-01
    相关资源
    最近更新 更多