机器学习-层级聚类算法(Hierarchy Cluster)

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 samplesEuclidean 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 = {
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值