摘要: import numpy as np x=np.random.randint(1,100,[20,1]) y=np.zeros(20) k=3 def initcent(x,k): #初始聚类中心数组 return x[0:k].reshape(k) def nearest(kc,i): #数组中的值,与聚类中心最小距离所在类别的索引号 d=(abs(kc-... 阅读全文
posted @ 2018-11-12 11:39 狮大大丶 阅读(200) 评论(0) 推荐(0)