k-MEANS距离
算欧拉距离:
1.np.sqrt(np.sum(np.square(X[i]-centroids[j])))
2.np.linalg.norm(X[i]-cemtroids[j])
算数组中最小值的索引:
np.argmin(distance)
3.取数组满足条件的索引
1 X[idx==1] 2 points=np.where(idx==1) X[points,:]
4.
np.sum(X[points,:],axis=1)
axis=1 //表示行 axis=0 //表示列
5.ravel()是将数组变为一维数组

浙公网安备 33010602011771号