![](https://img-blog.csdn.net/20170508133451449?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaGI3MDc5MzQ3Mjg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
带宽: 0.1 0.531661129692 聚类簇的个数为: 7
['#ff0000', '#d4802a', '#aa0055', '#7f807f', '#5500aa', '#2a80d4', '#0000ff']
带宽: 0.2 1.06332225938 聚类簇的个数为: 4
['#ff0000', '#aa0055', '#5500aa', '#0000ff']
带宽: 0.3 1.59498338907 聚类簇的个数为: 3
['#ff0000', '#7f807f', '#0000ff']
带宽: 0.4 2.12664451877 聚类簇的个数为: 1
['#ff0000']
# -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import sklearn.datasets as ds
import matplotlib.colors
from sklearn.cluster import MeanShift
from sklearn.metrics import euclidean_distances
#MeanShift 均值漂移算法 原理