Example for Agglomerative Clustering

本文详细介绍了层次聚类算法的基本概念、实现方法及在实际数据集中的应用案例,包括距离度量、聚类树构建和不同聚类策略的影响。通过实例分析,展示了层次聚类在数据分类和聚类分析领域的强大能力。
部署运行你感兴趣的模型镜像

转自http://en.wikipedia.org/wiki/Hierarchical_clustering

 

For example, suppose this data is to be clustered, and the Euclidean distance is the distance metric.

Cutting the tree at a given height will give a partitioning clustering at a selected precision. In this example, cutting after the second row will yield clusters {a} {b c} {d e} {f}. Cutting after the third row will yield clusters {a} {b c} {d e f}, which is a coarser clustering, with a smaller number of larger clusters.

Raw data

The hierarchical clustering dendrogram would be as such:

Traditional representation

This method builds the hierarchy from the individual elements by progressively merging clusters. In our example, we have six elements {a} {b} {c} {d} {e} and {f}. The first step is to determine which elements to merge in a cluster. Usually, we want to take the two closest elements, according to the chosen distance.

Optionally, one can also construct a distance matrix at this stage, where the number in the i-th row j-th column is the distance between the i-th and j-th elements. Then, as clustering progresses, rows and columns are merged as the clusters are merged and the distances updated. This is a common way to implement this type of clustering, and has the benefit of caching distances between clusters. A simple agglomerative clustering algorithm is described in the single-linkage clustering page; it can easily be adapted to different types of linkage (see below).

Suppose we have merged the two closest elements b and c, we now have the following clusters {a}, {b, c}, {d}, {e} and {f}, and want to merge them further. To do that, we need to take the distance between {a} and {b c}, and therefore define the distance between two clusters. Usually the distance between two clusters \mathcal{A} and \mathcal{B} is one of the following:

 \max \{\, d(x,y) : x \in \mathcal{A},\, y \in \mathcal{B}\,\}.
 \min \{\, d(x,y) : x \in \mathcal{A},\, y \in \mathcal{B} \,\}.
  • The mean distance between elements of each cluster (also called average linkage clustering, used e.g. in UPGMA):
 {1 \over {|\mathcal{A}|\cdot|\mathcal{B}|}}\sum_{x \in \mathcal{A}}\sum_{ y \in \mathcal{B}} d(x,y).
  • The sum of all intra-cluster variance.
  • The increase in variance for the cluster being merged (Ward's method[6])
  • The probability that candidate clusters spawn from the same distribution function (V-linkage).

Each agglomeration occurs at a greater distance between clusters than the previous agglomeration, and one can decide to stop clustering either when the clusters are too far apart to be merged (distance criterion) or when there is a sufficiently small number of clusters (number criterion).

您可能感兴趣的与本文相关的镜像

Dify

Dify

AI应用
Agent编排

Dify 是一款开源的大语言模型(LLM)应用开发平台,它结合了 后端即服务(Backend as a Service) 和LLMOps 的理念,让开发者能快速、高效地构建和部署生产级的生成式AI应用。 它提供了包含模型兼容支持、Prompt 编排界面、RAG 引擎、Agent 框架、工作流编排等核心技术栈,并且提供了易用的界面和API,让技术和非技术人员都能参与到AI应用的开发过程中

### 回答1: 聚合层次聚类(Agglomerative Clustering)是一种常见的聚类算法,其基本思想是将数据逐渐合并成更大的类别,直到达到预定的聚类数目为止。 具体来说,聚合层次聚类从每个数据点作为单独的类别开始,然后根据相似度指标,将最相似的两个类别合并成一个新的类别,直到所有数据点都属于同一个类别或者达到预设的聚类数目。 聚合层次聚类可以通过不同的相似度指标来度量不同类型的数据之间的相似性,常用的相似度指标包括欧几里得距离、曼哈顿距离、余弦相似度等。在合并过程中,可以采用不同的合并策略,如单链接、完全链接、平均链接等。 聚合层次聚类通常需要计算全部的数据点之间的相似度,因此计算复杂度较高。但它具有易于理解和可视化的优点,可以通过树状图表示聚类过程,帮助用户更好地理解聚类结果。 ### 回答2: 凝聚聚类是一种常见的聚类方法,也被称为自下而上聚类。该算法从一个初始状态开始,每次将最接近的数据点或群体合并在一起,不断地形成丰富的层次化结构,最终形成聚类。凝聚聚类的主要特点是可以在未知初始聚类数的情况下自动确定聚类数量。 凝聚聚类的工作原理很简单。首先,它计算每个样本之间的相似度或距离并将它们作为起点。然后,聚类一步步合并这些相邻点,直到所有点都被聚类成一组。 凝聚聚类通常有两种方法来评估点(或者样本)之间的距离: 1. 层次聚类 层次聚类的倾向是使得最小群组最大化或者最大群组最小化。层次聚类的步骤通常是计算每个点之间的距离,然后将最近的点成对合并在一起,这样就形成了一个群组。接下来,再将最相似的群组再次合并,直至最终只剩一个群组。 2. 相关聚类 相关聚类评估数据点之间的相似度。最常见的方法是基于距离度量作为相似性的函数。相关聚类与层次聚类十分相似,不同之处在于在相关聚类中,每个群组都是基于它们之间的相似性。 凝聚聚类的主要优点是可以自动识别出稠密和疏散聚类,并且可以处理噪声和异常点,但是其计算和内存开销均比较大。在实际使用中,还需要根据具体情况选择合适的距离函数,以便得到最优的聚类结果。 ### 回答3: 聚合性聚类是一种基于相似性度量的无监督学习算法,也称为自下而上聚类。在聚合性聚类中,每个数据点被视为一个单独的簇,然后簇之间通过相似性度量来逐步合并,以形成完整的层次结构,直到所有簇合并成为一个单一的簇。 聚合性聚类算法通常包括以下步骤: 1. 初始化:将每个数据点视为一个单独的簇。 2. 相似性度量:对于每对簇,计算它们之间的相似性得分。 3. 合并:通过选择得分最高的簇对来合并簇,将它们合并成一个新的簇。 4. 重复上述步骤,直到所有簇都被合并为一个单独的簇。 在聚合性聚类的过程中,相似性度量是关键因素。常用的相似性度量包括欧几里德距离、曼哈顿距离和马氏距离等。根据不同的数据类型和应用场景,我们可以选择不同的相似性度量来进行聚类。 聚合性聚类的一个重要应用是图像分割。在这种情况下,数据点是像素,而相似性度量可以基于像素之间的亮度、颜色和纹理等特征进行计算。通过聚合性聚类,我们可以将图像分割成不同的区域,从而提取出有用的图像特征。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值