机器学习–聚类算法之mean shift

聚类算法之mean shift

相对于k-mean和k-mean++算法,mean shift(均值偏移)算法,都是基于聚类中心的聚类算法。但是,mean shift的优势在于不需要事先制定类别个数k(无监督学习)。
mean shift的基本概念:沿着密度上升方向寻找聚簇点。

  1. 算法解析

2.1 算法流程

设想在一个有N个样本点的特征空间,利用mean shift算法对数据进行分类

  1. 初始确定一个中心点center,计算在设置的半斤为D的圆形空间内所有的点与中心点center 的向量
  2. 计算整个圆形空间内所有向量的平均值,得到一个偏移均值
  3. 将中心点center移动到偏移均值位置
  4. 重复移动,直到满足一定条件结束
    [TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:72878443-a630-46a8-bf49-5fe3672b0ea9
    [En]

    [TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:edfa0827-f758-4669-a3d1-94f09832d412

    机器学习--聚类算法之mean shift
    [TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:b335c9f4-97bc-4b0f-9fac-f4bfa5347686
    [En]

    [TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:52029dcb-f13f-4357-9fe5-24ac54616f8f

    机器学习--聚类算法之mean shift

; 2.2 算法公式

偏移均值的公式:

机器学习--聚类算法之mean shift
Sh:以x为中心点,半径为h的高维球区域; k:包含在Sh范围内点的个数; xi:包含在Sh范围内的点
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:6a70902b-8538-4e97-8b6f-848fe6c71c99
[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:141858c6-60ea-4f7f-be18-61edfd8280bb

机器学习--聚类算法之mean shift
Mt为t状态下求得的偏移均值; xt为t状态下的中心

后来,Yizong Cheng对mean shift进行补充,主要提出了两点的改进:定义了核函数,增加了权重系数。核函数的定义使得偏移值对偏移向量的贡献随之样本与被偏移点的距离的不同而不同。权重系数使得不同样本的权重不同。

引入核函数的mean shift公式:
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:23562c6a-4a1b-4144-9475-e12fb690e4a3

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:1f09061b-1db7-4c4b-92cc-1c96e7732981

机器学习--聚类算法之mean shift
其中,x为中心点;xi为带宽范围内的点;n为带宽范围内的点的数量;g(x)为对核函数的导数求负

3.mean shift的应用场景

Mean Shift算法在很多领域都有成功应用,例如图像平滑、图像分割、物体跟踪等,这些属于人工智能里面模式识别或计算机视觉的部分;另外也包括常规的聚类应用。

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:cf9876ef-0594-4f7a-9210-fcfceff63db3

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:d35c0c2b-34e8-49a0-9271-ce4423389cdf

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:e6f9d151-652d-4e50-b0e9-d7fa975ced36

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:858fae6d-489c-4d85-a1c7-915f3f0ef4bc

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:aaba659b-f2b0-4129-a6f0-99cca38496f1

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:61a71e8d-2678-4e77-86f0-6ce187aa1a60

* 常规聚类,如用户聚类等

4.实例分析

基于均值漂移的分类:

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:c3c5bae3-ce54-489f-9bcd-903743ef7f2e

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:5577c939-a0d8-48e9-929f-a248a8c18a96

* 找出离中心点距离在带宽之内的所有点,记做集合M,认为这些点属于簇c
* 计算从中心点开始到集合M中每个元素的向量,将这些向量相加,得到偏移向量
* 中心点沿着shift的方向移动,移动距离是偏移向量的模
* 重复步骤2、3、4,直到偏移向量的大小满足设定的阈值要求,记住此时的中心点
* 重复1、2、3、4、5直到所有的点都被归类
[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:cf9a89a5-d380-4948-af8c-86cee7cea1dd

[En]

[TencentCloudSDKException] code:FailedOperation.ServiceIsolate message:service is stopped due to arrears, please recharge your account in Tencent Cloud requestId:fb27df0c-36cf-4e3e-8c6d-58fc2d728f72

参考链接:

  1. https://www.biaodianfu.com/mean-shift.html
  2. https://blog.csdn.net/qwerasdf_1_2/article/details/54577336

Original: https://blog.csdn.net/qq_42178122/article/details/115917436
Author: Good@dz
Title: 机器学习–聚类算法之mean shift

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/560700/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球