python内实现k-means聚类
来源:互联网 发布:cms推荐 编辑:程序博客网 时间:2024/06/08 00:11
《Python计算机视觉编程》学习笔记
from scipy.cluster.vq import *import numpy as npfrom matplotlib import pyplot as pltclass1=1.5*np.random.randn(100,2)##print(class1)class2=np.random.randn(100,2)+np.array([8,8])##print(class2)features=np.vstack((class1,class2))centroids,variance=kmeans(features,2)code,distance=vq(features,centroids)plt.figure()ndx=np.where(code==1)[0]plt.plot(features[ndx,0],features[ndx,1],'*')ndx=np.where(code==0)[0]plt.plot(features[ndx,0],features[ndx,1],'r.')plt.plot(centroids[:,0],centroids[:,1],'go')plt.axis('off')plt.show()
参考资料:
Python计算机视觉编程,第6章,P137
0 0
- python内实现k-means聚类
- Python实现K-means聚类
- K-Means Python实现
- python k-means聚类
- Python 实现K-means算法
- Python实现k-means算法
- Python实现k-means算法
- K-means的Python实现
- k-means算法Python实现
- K-means的python实现
- K-means算法 Python实现
- 聚类 K-Means Using Python
- MapReduce 实现k-means聚类
- k-means聚类java实现
- matlab实现k-means聚类
- JAVA实现K-means聚类
- K-Means聚类MATLAB实现
- Clustering (1): k-means(Python实现)
- 【jQuery】兼容IE6的表格前端搜索
- 编程挑战:查询
- 标记一下
- minimum adjustment cost
- Python类与继承
- python内实现k-means聚类
- 第十三周项目1-动物这样叫
- spark基础(二)-----------scala在spark shell里的应用
- 初级算法整理,整数前后换位
- 连载三---探索Objc/Runtime
- 机器学习Matlab实战之垃圾邮件分类————朴素贝叶斯模型
- Jave利用动态代理实现AOP
- hdoj 3549 Flow Problem 【最大流入门 dinic算法】
- 黑马程序员--逻辑运算的优先级和结合性