Section I: Brief Introduction on Hierarchy Cluster
The two standard algorithms for agglomerative hierarchical clustering are single linkage and complete linkage. Using single linkage, the distances between the most similar members for each pair of clusters and merge the two clusters for which the distance between the most similar members is the smallest. With respect to complete linkage, the approach is similar to single linkage but, instead of comparing the most similar members in each pair of clusters, it compare the most dissimilar members to perform the merge.
Hierarchical complete linkage clustering is an iterative procedure that can be summarized by the following steps:
- Step 1: Compute the distance matrix of all samples (Euclidean Distance)
- Step 2: Represent each data point as a singleton cluster
- Step 3: Merge the two closest clusters based on the distance between the most similar/dissimilar (distant) members
- Step 4: Update similarity matrix
- Step 5: Repeat steps 2-4 until one single cluster remains
FROM
Sebastian Raschka, Vahid Mirjalili. Python机器学习第二版. 南京:东南大学出版社,2018.
第一部分: 数据初始化
代码
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
plt.rcParams['figure.dpi']=200
plt.rcParams['savefig.dpi']=200
font = {

本文简要介绍了层次聚类中的两种基本算法:单链和完全链。详细阐述了完全链聚类的迭代过程,包括计算样本间欧氏距离,将每个数据点视为单例集群,基于最相似成员的距离合并最近的集群,更新相似性矩阵,直到只剩下一个集群。同时,提供了使用scipy库进行欧氏距离计算的两种方法。
最低0.47元/天 解锁文章
592

被折叠的 条评论
为什么被折叠?



